diff options
Diffstat (limited to 'js/ui/nopaint.js')
| -rw-r--r-- | js/ui/nopaint.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/js/ui/nopaint.js b/js/ui/nopaint.js index da30e37..c76d269 100644 --- a/js/ui/nopaint.js +++ b/js/ui/nopaint.js @@ -452,6 +452,57 @@ var nopaint = (function(){ this.resize(3,2) }, }) + + var ShadowBrush = NopaintBrush.extend({ + type: "shadow", + pairs: [ + [ colors.yellow, colors.orange ], + [ colors.orange, colors.darkred ], + [ colors.red, colors.darkred ], + [ colors.lime, colors.green ], + [ colors.cyan, colors.teal ], + [ colors.cyan, colors.blue ], + [ colors.blue, colors.darkblue ], + [ colors.magenta, colors.purple ], + [ colors.lightgray, colors.darkgray ], + [ colors.darkgray, colors.black ], + [ colors.white, colors.lightgray ], + [ colors.white, colors.black ], + ], + shapes: [ + [[0],[1]], + [[0,0],[1,1]], + [[1,0,0],[1,1,1]], + [[0,0,1],[1,1,1]], + [[0,0,0],[1,1,1]], + [[0,0,0,0],[1,1,1,1]], + [[1,0,0,0],[null,1,1,1]], + [[0,0,0,1],[1,1,1,null]], + [[0,0],[1,0],[1,1]], + [[0,0],[0,1],[1,1]], + ], + reset: function( last_brush ){ + var pair = choice(this.pairs) + var shape = choice(this.shapes) + this.reorient( last_brush ) + brush.char = " " + console.log(shape[0].length, shape.length) + brush.resize(shape[0].length, shape.length) + brush.generate() + brush.rebuild() + brush.forEach(function(lex,x,y){ + if (shape[y][x] == null) { + lex.opacity = 0 + } + else { + lex.fg = lex.bg = pair[ shape[y][x] ] + lex.opacity = 1 + } + lex.build() + }) + }, + regenerate: function(){}, + }) var RandomBrush = SolidBrush.extend({ type: "random", @@ -766,6 +817,7 @@ var nopaint = (function(){ }) nopaint.add_tool( new SolidBrush({ weight: 5 }) ) + nopaint.add_tool( new ShadowBrush({ weight: 10 }) ) nopaint.add_tool( new EraseBrush({ weight: 5 }) ) nopaint.add_tool( new RandomBrush({ weight: 4 }) ) nopaint.add_tool( new HueBrush({ weight: 5 }) ) |
