summaryrefslogtreecommitdiff
path: root/js/ui/nopaint.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-05-11 02:05:12 -0400
committerJules Laplace <jules@okfoc.us>2016-05-11 02:05:12 -0400
commit93151c4788106e56a53bfd4dfd2f089cadb00c63 (patch)
tree4dc47535645f6c26e71e469ba469649ea4b479d3 /js/ui/nopaint.js
parente90ba4585159f0183586b6ac82358b927c709a7e (diff)
fix no behavior..
Diffstat (limited to 'js/ui/nopaint.js')
-rw-r--r--js/ui/nopaint.js20
1 files changed, 16 insertions, 4 deletions
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()
}