summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/ui/keys.js1
-rw-r--r--js/ui/nopaint.js20
2 files changed, 16 insertions, 5 deletions
diff --git a/js/ui/keys.js b/js/ui/keys.js
index a83ac55..09d63fc 100644
--- a/js/ui/keys.js
+++ b/js/ui/keys.js
@@ -161,7 +161,6 @@ var keys = (function(){
}
keys.left_right_key = function (fn) {
return function (e){
- console.log(e.keyCode)
switch (e.keyCode) {
case 39: // right
e.preventDefault()
diff --git a/js/ui/nopaint.js b/js/ui/nopaint.js
index 292e83e..bb6641c 100644
--- a/js/ui/nopaint.js
+++ b/js/ui/nopaint.js
@@ -43,6 +43,7 @@ var nopaint = (function(){
}
nopaint.undo = function(){
undo.undo()
+ nopaint.play()
}
controls.paint.lex.raw_key = nopaint.raw_key = keys.left_right_key(function(n){
if (! nopaint.timeout) return
@@ -56,6 +57,8 @@ var nopaint = (function(){
nopaint.step = 0
}
nopaint.play = function(){
+ var state = undo.new()
+ delete state.focus
nopaint.pause()
nopaint.switch_tool()
nopaint.go()
@@ -68,13 +71,10 @@ var nopaint = (function(){
nopaint.step += 1
}
nopaint.switch_tool = function(){
- var state = undo.new()
- delete state.focus
last_tool = nopaint.tool
last_tool && last_tool.finish()
nopaint.tool = nopaint.get_random_tool()
nopaint.tool.start( last_tool )
- console.log(nopaint.tool.type)
}
nopaint.add_tool = function(fn){
nopaint.tools[fn.type] = fn
@@ -125,6 +125,7 @@ var nopaint = (function(){
},
start: function(last_brush){
+ this.toggle_channels()
this.reset( last_brush )
this.regenerate()
draw.down({}, null, [this.p.x, this.p.y])
@@ -178,6 +179,17 @@ var nopaint = (function(){
b.y = this.p.y + randrange(-radius, radius)
return b
},
+
+ toggle_channels: function(){
+ if (Math.random() < 0.01) { controls.bg.use(false) }
+ else if (! brush.draw_bg && Math.random() < 0.25) { controls.bg.use(true) }
+
+ if (Math.random() < 0.2) { controls.fg.use(false) }
+ else if (! brush.draw_fg && Math.random() < 0.5) { controls.fg.use(true) }
+
+ if (Math.random() < 0.05) { controls.char.use(false) }
+ else if (! brush.draw_char && Math.random() < 0.2) { controls.char.use(true) }
+ },
iterate: function( last_brush ){
this.reorient( last_brush )
@@ -315,7 +327,7 @@ var nopaint = (function(){
var lex = canvas.get(this.p.x, this.p.y)
undo.save_lex(lex.x, lex.y, lex)
lex.fg = rand_hue()
- lex.bg = colors.black
+ // lex.bg = colors.black
lex.char = choice(this.chars)
lex.build()
}