Powered by vanilla & lovin' it!
crankyboy:It's 150 frames. Too many for javascript?not too many no
for (i=1; i<=150; i++) {
demo[i] = new Image();
demo[i].setAttribute('src','demo' + i + '.jpg');
}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test Animated GIF is Loaded</title>
<script type='text/javascript'>
// *********************** CHANGE THE VALUES HERE TO CHANGE THE PERFORMANCE
var imagePrefix = 'demo_'; // All frames to have this name prefix
var imageFormat = 'gif'; // All frames to have this file format - any format is fine - the smaller the better though
var frameCount = 60; // Total frames
var swapDelay = 5; // Sets the speed of the animation - play with it til youre happy with the speed
var loop = 3; // Optional looping - change this to the number of loops you would like
// *********************** DON'T CHANGE ANYTHING BELOW THIS LINE
var animImage = new Array;
var animGif = null;
var count = 1;
var countCheck = 0;
var loopCount =1;
window.onload = windowInit;
function windowInit() {
animGif = document.getElementById('animGif'); // Points to image on page
imageSwapTimer = window.setInterval('imageSwap()', swapDelay)
}
function imageSwap() {
if (animGif) {
if (count > frameCount && loop == loopCount) { // Finished the Animation and the looping
window.clearInterval(imageSwapTimer);
window.location.replace('http://www.ihcra.com/giftest/tester2.html'); // Do the redirect
} else if (count > frameCount && loop !=loopCount) { // run another loop
count = 1;
loopCount++;
} else { // load next frame
if (countCheck != count) {
// *********************** THIS WHERE SWAPS SHOULD BE MADE FOR PRELOADED IMAGES
var newImage = new Image();
newImage.src = imagePrefix + count + '.' + imageFormat;
newImage.id = 'animGif';
// *********************** END CODE EDIT HERE
countCheck = count
animGif.parentNode.replaceChild(newImage, animGif)
animGif = document.getElementById('animGif'); // Repoints to image on page
animGif.setAttribute('onload', 'count++');
}
}
}
}
</script>
</head>
<body>
<img id='animGif' src="./demo_1.gif">
</body>
</html>
1 to 18 of 18