summaryrefslogtreecommitdiff
path: root/js/ui/nopaint.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/ui/nopaint.js')
-rw-r--r--js/ui/nopaint.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/js/ui/nopaint.js b/js/ui/nopaint.js
index bf94bdc..d3741a9 100644
--- a/js/ui/nopaint.js
+++ b/js/ui/nopaint.js
@@ -33,6 +33,7 @@ var nopaint = (function(){
oktween.raf = function(){}
var nopaint = {}
+ nopaint.debug = true
nopaint.delay = nopaint.normal_delay = 100
nopaint.turbo_delay = 0
nopaint.tool = null
@@ -83,7 +84,7 @@ var nopaint = (function(){
last_tool && last_tool.finish()
nopaint.tool = nopaint.get_random_tool( last_tool )
nopaint.tool.start( last_tool )
- console.log("> %s", nopaint.tool.type)
+ nopaint.debug && console.log("> %s", nopaint.tool.type)
}
nopaint.add_tool = function(fn){
nopaint.tools[fn.type] = fn
@@ -143,6 +144,9 @@ var nopaint = (function(){
upload_interval: 100,
step: 0,
timeout: null,
+ delay: function(){
+ return nopaint.is_turbo ? randrange(150, 300) : randrange(400, 800)
+ },
reset: function(){
this.no_count = 0
this.paint_count = 0
@@ -153,7 +157,7 @@ var nopaint = (function(){
},
play: function(){
clearTimeout(this.timeout)
- var delay = nopaint.is_turbo ? randrange(150, 300) : randrange(400, 800)
+ var delay = this.delay()
this.timeout = setTimeout(this.play.bind(this), delay)
this.check_fitness()
this.step += 1
@@ -451,6 +455,14 @@ var nopaint = (function(){
},
})
+ var GrayBrush = SolidBrush.extend({
+ type: "hue",
+ recolor: function(){
+ this.fg = this.bg = rand_gray()
+ this.char = " "
+ },
+ })
+
var LetterBrush = SolidBrush.extend({
type: "letter",
recolor: function(){
@@ -742,6 +754,7 @@ var nopaint = (function(){
nopaint.add_tool( new EraseBrush({ weight: 5 }) )
nopaint.add_tool( new RandomBrush({ weight: 4 }) )
nopaint.add_tool( new HueBrush({ weight: 5 }) )
+ nopaint.add_tool( new GrayBrush({ weight: 5 }) )
nopaint.add_tool( new LetterBrush({ weight: 2 }) )
nopaint.add_tool( new RandomLetterBrush({ weight: 12 }) )
nopaint.add_tool( new CloneBrush({ weight: 8 }) )