I've noticed that for both what I'm working on locally and in this fiddle, the GIF animation either won't play or will quickly skip between 2 frames. However, if the GIF is set by in DOM/HTML and nothing changes in the JS, the animation plays fine like in this fiddle.
step: function(img, tween) {
if (img <= -20) {
$(this).attr('src', 'http://en.clipart-fr.com/data/gif/Dogs/animated_gif_dogs_011.gif');
}
if (img > -20 ) {
//change the falling image picture
$(this).attr("src", "http://placehold.it/100/50");
ape = 1;
}
}
My assumption is that, because the "src" in the JS is being set in the "step" function, the function is constantly resetting it and thus the animation never moves past the first frame. (something like that)
I would like to have a frame animation occur (whilst the falling happens), and when the falling position (of the original, "easeOutBounce" animation) of that animation reaches a certain point, have the "src" change to a single png image. However, if on the bounce back the image bounce back up past a certain point, I would like the frame animation to start playing again. Suggestions on how I can accomplish this?
Thanks for the continuing help, SO community.
EDIT: Okay, nobody has responded yet so I've started experimenting with different methods. Currently I'm trying https://stackoverflow.com/a/9669981/3862501, but the images do not appear. (Is the document.ready function not continually updating?)
var animPort = ["1.png", "2.png", "3.png", "4.png", "5.png"];
$(document).ready(function() {
for (var i=0; i<animPort.length; i++) {
var animatePortfolio = setInterval(function() {
$("#portfolio").attr('src', 'images/home/animate/'+animPort[i]);
}, 1300);
}
});