From 61ea379940152da18052a02185eb204fc7a9683d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 22 Nov 2014 15:17:16 -0500 Subject: color functions and animate switch --- js/app.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'js/app.js') diff --git a/js/app.js b/js/app.js index a5e3aea..70f46f1 100644 --- a/js/app.js +++ b/js/app.js @@ -9,14 +9,6 @@ var focused var canvas, tools, palette, brush, mode, current_tool -var color_names = ("white black dark-blue green red dark-red purple orange " + - "yellow lime dark-cyan cyan blue magenta dark-gray light-gray").split(" "); -var color_hue_order = ("black dark-blue purple dark-red red orange " + - "yellow lime green dark-cyan cyan blue magenta dark-gray light-gray white").split(" "); -var letters = "abcdefghijklmnop"; -var colors = {}, controls = {} -color_names.forEach(function(name, i){ colors[name] = i }) - function init () { build() bind() @@ -113,6 +105,13 @@ function build () { fn && shader.run(canvas) }) + controls.animate = new Tool (animate_checkbox) + controls.animate.use = function(){ + var state = shader.toggle() + if (state) animate_checkbox.innerHTML = "x animate" + else animate_checkbox.innerHTML = "_ animate" + } + controls.width = new Lex (width_el) controls.height = new Lex (height_el) controls.canvas_width = new Lex (canvas_width_el) @@ -175,7 +174,7 @@ function bind () { }) }); - [controls.square, controls.circle, controls.text, controls.clear, controls.grid, controls.shader].forEach(function(tool){ + [controls.square, controls.circle, controls.text, controls.clear, controls.grid, controls.shader, controls.animate].forEach(function(tool){ tool.span.addEventListener('mousedown', function(e){ tool.focus() }) -- cgit v1.2.3-70-g09d2