summaryrefslogtreecommitdiff
path: root/js/ui
diff options
context:
space:
mode:
Diffstat (limited to 'js/ui')
-rw-r--r--js/ui/controls.js44
-rw-r--r--js/ui/evolver.js12
-rw-r--r--js/ui/goodies.js132
3 files changed, 175 insertions, 13 deletions
diff --git a/js/ui/controls.js b/js/ui/controls.js
index 1dd83c7..315395d 100644
--- a/js/ui/controls.js
+++ b/js/ui/controls.js
@@ -164,6 +164,13 @@ var controls = (function(){
clipboard.show()
clipboard.export_mode()
}
+ controls.send_to_irc = new ClipboardTool (send_to_irc_el)
+ controls.send_to_irc.use = function(){
+ changed && clipboard.upload_png()
+ clipboard.show()
+ clipboard.export_mode()
+ alert('your ascii art is now on display on the IRC channel inside the panke.gallery!')
+ }
controls.load = new ClipboardTool (load_el)
controls.load.use = function(){
// console.log("use")
@@ -222,6 +229,18 @@ var controls = (function(){
this.update(state)
}
+ controls.advanced = new BlurredCheckbox (advanced_checkbox)
+ controls.advanced.memorable = true
+ controls.advanced.use = function(state){
+ console.log(state)
+ state = document.body.classList.contains('panke')
+ if (state)
+ document.body.classList.remove('panke')
+ else
+ document.body.classList.add('panke')
+ this.update(state)
+ }
+
/*
controls.nopaint = new HiddenCheckbox (nopaint_toggle)
controls.nopaint.memorable = true
@@ -262,14 +281,25 @@ var controls = (function(){
// this.update(canvas.rotated)
// }
- controls.pixels = new BlurredCheckbox (pixels_checkbox)
- controls.pixels.memorable = true
- controls.pixels.use = function(state){
- canvas.pixels = typeof state == "boolean" ? state : ! canvas.pixels
- document.body.classList.toggle("pixels", canvas.pixels)
- this.update(canvas.pixels)
- }
+ // controls.pixels = new BlurredCheckbox (pixels_checkbox)
+ // controls.pixels.memorable = true
+ // controls.pixels.use = function(state){
+ // canvas.pixels = typeof state == "boolean" ? state : ! canvas.pixels
+ // document.body.classList.toggle("pixels", canvas.pixels)
+ // this.update(canvas.pixels)
+ // }
+ controls.mirror_x = new BlurredCheckbox (mirror_x_checkbox)
+ controls.mirror_x.use = function(state){
+ window.mirror_x = typeof state == "boolean" ? state : ! window.mirror_x
+ this.update(window.mirror_x)
+ }
+ controls.mirror_y = new BlurredCheckbox (mirror_y_checkbox)
+ controls.mirror_y.use = function(state){
+ window.mirror_y = typeof state == "boolean" ? state : ! window.mirror_y
+ this.update(window.mirror_y)
+ }
+
//
controls.vertical = new BlurredCheckbox (vertical_checkbox)
diff --git a/js/ui/evolver.js b/js/ui/evolver.js
index 4d90893..0e4df77 100644
--- a/js/ui/evolver.js
+++ b/js/ui/evolver.js
@@ -4,10 +4,10 @@ var evolver = (function(){
var opt = {
src: "img/test/quad.gif",
- w: 30,
+ w: 50,
h: 0,
- population: 10,
- strokes: 1,
+ population: 4,
+ strokes: 2,
randomize: false,
mode: 'all',
}
@@ -164,11 +164,11 @@ var evolver = (function(){
var max_score = clones[0].score
-// console.log(clones.filter(function(c,i){ return i < 10 }).map(function(c){ return c.score.toFixed(2) }).join(" "))
+ // console.log(clones.filter(function(c,i){ return i < 10 }).map(function(c){ return c.score.toFixed(2) }).join(" "))
if (max_score < last_score) {
// console.log("no improvement [%s] [%s]", max_score.toFixed(3), last_score.toFixed(3))
- clones_to_keep = 3
+ clones_to_keep = 1
best_clone = main_canvas
next_best_clone = clones[0].canvas
third_best_clone = clones[1].canvas
@@ -176,7 +176,7 @@ var evolver = (function(){
else {
last_score = max_score
- clones_to_keep = 3
+ clones_to_keep = 2
best_clone = clones[0].canvas
next_best_clone = clones[1].canvas
third_best_clone = clones[2].canvas
diff --git a/js/ui/goodies.js b/js/ui/goodies.js
new file mode 100644
index 0000000..67f245c
--- /dev/null
+++ b/js/ui/goodies.js
@@ -0,0 +1,132 @@
+var goodies = (function(){
+ var goodies = {}
+
+ goodies.build = () => {
+ Object.keys(goodies.list).map(() => {
+ goodies_rapper.appendChild(tool_canvas.el)
+ })
+ }
+
+ goodies.list = {}
+
+ goodies.list.choppy = {
+ mode: 'brush',
+ fn: `var char = choice(" abcdef ")
+ lex.bg = +choice("0124")
+ lex.fg = +choice("01234")
+ lex.char = char
+ lex.opacity = char == " " ? 0 : 1`,
+ }
+
+ goodies.list.foggy = {
+ mode: 'brush',
+ fn: `var char = choice(" abcdef ")
+ lex.bg = choice([14,15])
+ lex.fg = choice("367")
+ lex.char = char
+ lex.opacity = char == " " ? 0 : 1`,
+ }
+ // goodies.list.name = {
+ // fn: ``,
+ // }
+ // goodies.list.name = {
+ // fn: ``,
+ // }
+ // goodies.list.name = {
+ // fn: ``,
+ // }
+ // goodies.list.name = {
+ // fn: ``,
+ // }
+
+// >> mirror brush (up-down)
+
+// NOTE: Animate this on the canvas, then draw:
+
+// if (x > h/2) {
+// lex.assign( canvas.aa[h-y][x] )
+// }
+
+
+
+// >> rainbow stardust brush
+
+// Uncheck BG and animate this to brush:
+
+// lex.fg = hue(t)
+// lex.char = choice(" ,'.,.','****** ")
+
+
+
+// >> noise brushes, works on a black background:
+
+// lex.bg = max(5, yellow(randint(t)))
+// lex.opacity = lex.bg == colors.black ? 0 : 1
+
+
+
+// >> simple rainbow:
+
+// if (lex.bg != 1) lex.bg = randint(t)
+// lex.opacity = lex.bg == colors.black ? 0 : 1
+
+
+
+// >> self-erasing:
+
+// if (lex.bg != 1) lex.bg = yellow(randint(t))
+// lex.opacity = lex.bg == colors.black ? 0 : 1
+
+
+
+// >> cycling rainbow brush
+
+// if (lex.bg != 1) lex.bg = hue( all_color_hue_order.indexOf( color_names[ lex.bg ] ) + 1 )
+// lex.opacity = lex.bg == colors.black ? 0 : 1
+
+
+
+// >> "stars" brush.. set your brush to paint just the character "#"
+
+// if (lex.char == "#") {
+// lex.fg = hue(randint(15))
+// lex.char = random() > 0.1 ? " " : "+@*.,\"+'*-"[randint(10)]
+// }
+
+
+
+// >> use fg char to mask mask what you're drawing on the bg
+
+// if (lex.char != "/") { lex.bg = 1 }
+
+
+
+// >> sharded glitch brush
+
+// Example: http://asdf.us/z/kksnvs.png
+
+// Use on a brush:
+
+// lex.bg = t/y/x
+// lex.opacity = lex.bg % 1 ? 0 : 1
+
+
+
+// >> incremental brush
+
+// Set your brush to be the ^ character, square, about 10x10
+// Draw "char" only
+// Then animate this shader on the canvas:
+
+// if (lex.char=="^") {
+// lex.bg += 1
+// lex.char = " "
+// }
+// lex.bg += 1
+
+
+
+
+
+ return goodies
+}) \ No newline at end of file