From 3a51572e8a6628f90e73e2ab0bca52a98d9540e7 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 23 Jan 2014 10:10:19 -0500 Subject: more shuffling --- js/frames.js | 32 ++++++++++++++++++++++++++++++++ shader-api.html | 44 ++++++++++++++++++++++---------------------- shader-picker.html | 26 +++----------------------- 3 files changed, 57 insertions(+), 45 deletions(-) diff --git a/js/frames.js b/js/frames.js index 0ae256c..c9c844d 100644 --- a/js/frames.js +++ b/js/frames.js @@ -1,4 +1,36 @@ +var frame_editor = {} + +frame_editor.init = function(){ + frame_editor.bind() +} + +frame_editor.bind = function(){ + $("#add-frame").click(add_frame) + $("#frames").sortable({ + start: drag_start, + stop: drag_stop + }); + $(document).on("click","#frames .remove",remove_frame) + $("#framecount").change(function(){ + var val = $(this).int() + if (val < 1 || isNaN(val)) $(this).val(val = 1) + if (val == 1) $("#add-frame").html("+add frame") + else $("#add-frame").html("+add frames") + }) + + $("#frames").disableSelection(); + $("#remove-all-frames").click(remove_all_frames) + $("#weave-frames").click(weave_frames) + $("#shuffle-frames").click(shuffle_frames) + $("#reverse-frames").click(reverse_frames) + $("#sort-frames").click(sort_frames) + + $("#render").click(render) + $("#save").click(save) + $("#upload").click(upload) +} + function add_frame(){ var frame_count = $("#framecount").int() if (frame_count < 2) { diff --git a/shader-api.html b/shader-api.html index dc22d10..ba8530e 100644 --- a/shader-api.html +++ b/shader-api.html @@ -22,15 +22,15 @@ a { color: #00f; } @@ -57,15 +57,15 @@ a { color: #00f; } -
-
+
+
- -
- - - -
+ +
+ + + +
@@ -102,16 +102,16 @@ var shader_gallery_template = $("#shader-gallery-template").html() $(init) function init(){ - $("#url").change(load) - $("#reset").click(reset) - $("#pause").click(pause) + $("#url").change(load) + $("#reset").click(reset) + $("#pause").click(pause) user.init() shader_gallery.init() - document.getElementById('shader').addEventListener('input', shader_build); + document.getElementById('shader').addEventListener('input', shader_build); - requestAnimationFrame(animate) + requestAnimationFrame(animate) } diff --git a/shader-picker.html b/shader-picker.html index 923f1b6..0f27d6a 100644 --- a/shader-picker.html +++ b/shader-picker.html @@ -147,32 +147,13 @@ function init(){ mousey = e.pageY }) - $("#add-frame").click(add_frame) - $("#frames").sortable({ - start: drag_start, - stop: drag_stop - }); - $(document).on("click","#frames .remove",remove_frame) - $("#framecount").change(function(){ - var val = $(this).int() - if (val < 1 || isNaN(val)) $(this).val(val = 1) - if (val == 1) $("#add-frame").html("+add frame") - else $("#add-frame").html("+add frames") - }) $("#background").change(function(){ document.body.style.backgroundColor = $("#background").string() }) - $("#frames").disableSelection(); - $("#remove-all-frames").click(remove_all_frames) - $("#weave-frames").click(weave_frames) - $("#shuffle-frames").click(shuffle_frames) - $("#reverse-frames").click(reverse_frames) - $("#sort-frames").click(sort_frames) - - $("#render").click(render) - $("#save").click(save) - $("#upload").click(upload) + frame_editor.init() + + $(window).on("scroll DOMMouseScroll mousewheel", function(){ scrolling = true }) $("#help,#instructions .close").click(function(){ $("#instructions").toggle() }) $("#instructions").draggable({ start: drag_start, @@ -181,7 +162,6 @@ function init(){ $("#instructions").disableSelection(); load() - $(window).on("scroll DOMMouseScroll mousewheel", function(){ scrolling = true }) gallery.choose = choose gallery.init() -- cgit v1.2.3-70-g09d2