summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/util.js2
-rw-r--r--shader-gif.html7
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