From 009007363dfca587c2cbbdbba6566179a05d8fb6 Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 26 Jan 2014 00:17:45 -0500 Subject: merge js into combo --- js/frames.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/frames.js') diff --git a/js/frames.js b/js/frames.js index c9c844d..2dddae2 100644 --- a/js/frames.js +++ b/js/frames.js @@ -29,6 +29,10 @@ frame_editor.bind = function(){ $("#render").click(render) $("#save").click(save) $("#upload").click(upload) + + $("#background").change(function(){ + document.body.style.backgroundColor = $("#background").string() + }) } function add_frame(){ @@ -121,8 +125,6 @@ function render (){ $("#render").html("rendering") } -function status(s){ $(".status").html(s) } - var encoder = new GifEncoder() encoder.on("quantized", function(url){ -- cgit v1.2.3-70-g09d2 From 654ff510a723f545fe64ae629972f1fdc2a2705a Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 26 Jan 2014 03:08:26 -0500 Subject: frame editor html --- js/frames.js | 5 +++-- shader-combo.html | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'js/frames.js') diff --git a/js/frames.js b/js/frames.js index 2dddae2..62306fa 100644 --- a/js/frames.js +++ b/js/frames.js @@ -1,3 +1,4 @@ +var frame_thumb_size = 93 var frame_editor = {} @@ -51,14 +52,14 @@ function add_single_frame(){ var frame = cc.clone().appendTo($el.find(".frame")[0]) frame.canvas.className = "fullsize" frame.canvas.style.display = "none" - var thumb = cc.clone().resize(100,100).appendTo($el.find(".frame")[0]) + var thumb = cc.clone().resize(frame_thumb_size,frame_thumb_size).appendTo($el.find(".frame")[0]) $("#frames").append($el) $("#render").enable() } function add_frames(frame_count){ rendering = true var t = old_t - start_t - pause_t - var frame_delay = $("#frameinterval").float() * 1000 + var frame_delay = ($("#frameinterval").float() || $("#framedelay").float()) * 1000 var frame for (var i = 0; i < frame_count; i++) { frame = giveFrame(t) diff --git a/shader-combo.html b/shader-combo.html index 0a5fcab..282e5e2 100644 --- a/shader-combo.html +++ b/shader-combo.html @@ -30,7 +30,7 @@ form { display: inline-block; } #instructions.dragging iframe { pointer-events: none; } #instructions .close { position: absolute; top: 5px; right: 5px; color: #f00; padding: 3px; border: 0;background: white; font-size: 10px; line-height: 10px; } -#frames { width: 435px; max-height: 150px; overflow: auto; border: 1px solid #ddd; line-height: 0; } +#frames { display: block; width: 404px; max-height: 150px; overflow: auto; border: 1px solid #ddd; line-height: 0; } #frames div { margin: 1px; padding: 0; position: relative; border: 1px solid #eee; cursor: -webkit-grab; } #frames canvas { display: block } #frames .remove { position: absolute; top: 5px; right: 5px; color: #f00; padding: 3px; border: 0;background: white; font-size: 10px; line-height: 10px; } @@ -112,7 +112,27 @@ form { display: inline-block; }
+
+ + frames + + + + +
+ + +
+
+ gif delay + background
-- cgit v1.2.3-70-g09d2 From d93bffc6438e6c89081b9b345c85a131a3de1138 Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 26 Jan 2014 03:13:42 -0500 Subject: display rendered gif in workspace --- js/frames.js | 5 +++-- js/render.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'js/frames.js') diff --git a/js/frames.js b/js/frames.js index 62306fa..1d08807 100644 --- a/js/frames.js +++ b/js/frames.js @@ -109,7 +109,7 @@ function render (){ encoder.addFrame(frame.canvas, delay) }) $("#pause,#render,#add-frame").disable() - $("#rendered").find("img").remove() + $("#workspace").find("img").remove() $("#rendered").show() // really bad results with neuquant? // status("quantizing") @@ -144,7 +144,8 @@ encoder.on("rendered", function(bytes){ encoder.on("rendered-url", function(url){ var image = new Image () lastGif = image.src = url - $("#rendered").append(image) + $("#workspace canvas").hide() + $("#workspace").append(image) $("#uploaded-url").hide().val("") $("#save,#upload,#rendered").show() $("#pause,#render,#add-frame,#save,#upload").enable() diff --git a/js/render.js b/js/render.js index e379ab8..6ad7560 100644 --- a/js/render.js +++ b/js/render.js @@ -80,7 +80,8 @@ function reset(){ start_t = old_t pause_t = 0 pause(false) - $("#rendered img").remove() + $("#workspace img").remove() + $("#workspace canvas").show() draw(0) } -- cgit v1.2.3-70-g09d2 From beb6a880100835aa44b8508a03b3b0b63562055a Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 26 Jan 2014 04:22:07 -0500 Subject: nicer loading logic --- js/frames.js | 11 ++++++----- js/image.js | 1 + js/render.js | 8 ++++++-- shader-combo.html | 32 ++++++++++++++++++-------------- 4 files changed, 31 insertions(+), 21 deletions(-) (limited to 'js/frames.js') diff --git a/js/frames.js b/js/frames.js index 1d08807..887b497 100644 --- a/js/frames.js +++ b/js/frames.js @@ -54,7 +54,6 @@ function add_single_frame(){ frame.canvas.style.display = "none" var thumb = cc.clone().resize(frame_thumb_size,frame_thumb_size).appendTo($el.find(".frame")[0]) $("#frames").append($el) - $("#render").enable() } function add_frames(frame_count){ rendering = true @@ -71,9 +70,6 @@ function add_frames(frame_count){ } function remove_frame(){ $(this).closest("div").remove() - if ($("#frames div").length == 0) { - $("#render").disable() - } } function remove_all_frames(){ $("#frames").empty() @@ -102,6 +98,11 @@ function sort_frames(){ function render (){ if (rendering) return rendering = true + + if ($("#frames canvas.fullsize").length == 0) { + add_frame() + } + encoder.reset() var delay = $("#framedelay").float() * 1000 || 100 $("#frames canvas.fullsize").each(function(){ @@ -149,7 +150,7 @@ encoder.on("rendered-url", function(url){ $("#uploaded-url").hide().val("") $("#save,#upload,#rendered").show() $("#pause,#render,#add-frame,#save,#upload").enable() - $("#render").html("render") + $("#render").html("render gif") rendering = false pause(true) }) diff --git a/js/image.js b/js/image.js index 4de7fd9..aabab89 100644 --- a/js/image.js +++ b/js/image.js @@ -2,6 +2,7 @@ var gif, img function loadImage(imageURL, callback) { var imageURL = proxify( imageURL ); + window.imageURL = imageURL window.gif = window.img = null diff --git a/js/render.js b/js/render.js index 6ad7560..cfc2d81 100644 --- a/js/render.js +++ b/js/render.js @@ -12,13 +12,17 @@ function choose (){ } function load(){ - var imageURL = $("#url").val() + var newImageURL = $("#url").val() loading = true - loadImage(imageURL, ready) + if (newImageURL != imageURL) { + loadImage(newImageURL, ready) + status("loading") + } } function ready(){ loading = false + status("") if (window.gif) { frame = gif.frames[0] actual_w = w = cc.canvas.width = frame.ctx.canvas.width diff --git a/shader-combo.html b/shader-combo.html index 3c28b54..f51037b 100644 --- a/shader-combo.html +++ b/shader-combo.html @@ -2,7 +2,7 @@ @@ -99,23 +101,20 @@ form { display: inline-block; }
- - + + + +
+
- - - -
- -
-
- - frames +
+ + frames -


+ gif delay background +   + + + +
-- cgit v1.2.3-70-g09d2 From e3297c52583f38ed71f7734f1ff04a267834e40c Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 26 Jan 2014 21:45:12 -0500 Subject: fix rendering bug --- js/api/gallery.js | 1 + js/frames.js | 3 +-- js/render.js | 2 ++ shader-combo.html | 11 +++++------ 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'js/frames.js') diff --git a/js/api/gallery.js b/js/api/gallery.js index 830ff93..e8af7f1 100644 --- a/js/api/gallery.js +++ b/js/api/gallery.js @@ -76,6 +76,7 @@ function load_shaders(err, shaders){ function display_shader(shader_object){ var $shader = $("
").addClass("shader") $shader.data("shader", shader_object) + $shader.data("id", shader_object.id) var html = shader_gallery_template for (var field in shader_object) { html = html.replace("{" + field + "}", shader_object[field]) diff --git a/js/frames.js b/js/frames.js index 887b497..571e862 100644 --- a/js/frames.js +++ b/js/frames.js @@ -97,12 +97,11 @@ function sort_frames(){ function render (){ if (rendering) return - rendering = true - if ($("#frames canvas.fullsize").length == 0) { add_frame() } + rendering = true encoder.reset() var delay = $("#framedelay").float() * 1000 || 100 $("#frames canvas.fullsize").each(function(){ diff --git a/js/render.js b/js/render.js index 205da88..bd6deb1 100644 --- a/js/render.js +++ b/js/render.js @@ -7,6 +7,7 @@ function choose (){ loading = true $("#url").val(this.src) loadImage(this.src, ready) + reset() } function load(){ @@ -84,6 +85,7 @@ function reset(){ pause(false) $("#workspace img").remove() $("#workspace canvas").show() + $("#uploaded-url").hide().val("") remove_all_frames() draw(0) } diff --git a/shader-combo.html b/shader-combo.html index 97ffd33..65b81e9 100644 --- a/shader-combo.html +++ b/shader-combo.html @@ -3,6 +3,10 @@ -
Shaders are little programs that draw a picture, pixel by pixel. With ShaderBlaster, use shaders on gifs and images to make new effects. +
Shaders are procedures that draw a picture by coloring each pixel individually. Use shaders on gifs and images to make new effects. Your basic variables are position (x, y), time (t), and color (r, g, b, a). -Many math functions such as cos and sqrt are available, along with functions from GLSL like step and mix. You can see a full list by clicking "commands" above. +Many math functions such as cos and sqrt are available, along with functions from GLSL like step and mix. You can see a full list by clicking "commands" above. When you make a cool effect, render a gif and save the shader for others to use. -Click "images" below to search Dumpfm and Photoblaster for images, or enter a URL at top left. - -If you make a cool effect, you can render it out to a gif, or save the shader for others to use. +You can apply these shaders to any image. Click "images" below to search Dumpfm and Photoblaster, or enter a URL at top left.
+ diff --git a/shader-localstorage.html b/shader-localstorage.html index 923f1b6..48c5184 100644 --- a/shader-localstorage.html +++ b/shader-localstorage.html @@ -125,6 +125,7 @@ a { color: #00f; } + + -- cgit v1.2.3-70-g09d2