summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/frames.js32
-rw-r--r--shader-api.html44
-rw-r--r--shader-picker.html24
3 files changed, 56 insertions, 44 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; }
<!--
<div id="gallery">
- <div id="gallery-form">
- <form id="gallery-search">
- <input type="text" id="dumpfm-search-query" value="duck bill">
- <button id="gallery-search">DUMP SEARCH</button>
- </form>
- <button id="gallery-random">IM RANDOM</button>
- <span class="status"></span>
- </div>
- <div id="gallery-images"></div>
+ <div id="gallery-form">
+ <form id="gallery-search">
+ <input type="text" id="dumpfm-search-query" value="duck bill">
+ <button id="gallery-search">DUMP SEARCH</button>
+ </form>
+ <button id="gallery-random">IM RANDOM</button>
+ <span class="status"></span>
+ </div>
+ <div id="gallery-images"></div>
</div>
-->
@@ -57,15 +57,15 @@ a { color: #00f; }
<input type="text" id="url" value="img/1376516658960-dumpfm-DoritoWitch-TimeFLyTrans0001.png">
<input type="text" id="username" placeholder="username">
<input type="text" id="shader-name" placeholder="shader name">
- <br>
- <br>
+ <br>
+ <br>
- <textarea id="shader"></textarea>
- <br>
- <button id="save-shader"><b>save shader</b></button>
- <button id="pause">pause</button>
- <button id="reset">reset</button>
- <br>
+ <textarea id="shader"></textarea>
+ <br>
+ <button id="save-shader"><b>save shader</b></button>
+ <button id="pause">pause</button>
+ <button id="reset">reset</button>
+ <br>
</div>
@@ -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)
+ frame_editor.init()
- $("#render").click(render)
- $("#save").click(save)
- $("#upload").click(upload)
+ $(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()