From f4eee2184b439c4e60edd3215441a212bf2bae58 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 17 Dec 2013 10:06:37 -0500 Subject: weird ish when loading gif still --- js/util.js | 2 +- shader-gif.html | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/js/util.js b/js/util.js index 3a03f55..fb15fb5 100644 --- a/js/util.js +++ b/js/util.js @@ -40,7 +40,7 @@ function randint(n){ return rand(n)|0 } function choice(a){ return a[randint(a.length)] } function deg(n){ return n*180/PI } function rad(n){ return n*PI/180 } -function pixel(x,y){ return 4*(y*w+x) } +function pixel(x,y){ return 4*(mod(y,h)*w+mod(x,w)) } function rgbpixel(d,x,y){ var p = pixel(x,y) r = d[p] diff --git a/shader-gif.html b/shader-gif.html index 9f7e398..59d2add 100644 --- a/shader-gif.html +++ b/shader-gif.html @@ -189,7 +189,12 @@ function draw(t) { var frame, img_frame; function giveFrame(t){ if (window.gif) { - return gif.frames[gif.currentFrame(t)] + if (gif.currentFrame) { + return gif.frames[gif.currentFrame(t)] + } + else { + return gif.frames[0] + } } else if (window.img) { return img_frame -- cgit v1.2.3-70-g09d2