Skip to content

Instantly share code, notes, and snippets.

@nilocesar
Created October 13, 2012 20:20
Show Gist options
  • Save nilocesar/3886004 to your computer and use it in GitHub Desktop.
Save nilocesar/3886004 to your computer and use it in GitHub Desktop.
create filmstrip by D3
animateArrows( "#filmStrip", 107, 29 )
//--------------------------------------
// ANIMATE FILM STRIP
//--------------------------------------
function animateArrows(target, amount, numFrames)
{
var incr = amount;
var newPos = 0;
moveImage();
function moveImage()
{
newPos -= incr;
$(target).css('marginTop', newPos);
if(newPos > -(amount*numFrames))
{
if( target == "#loaderStrip" )
{
setTimeout(moveImage, 60);
}
else
{
setTimeout(moveImage, 20);
}
}
else
{
if( target == "#loaderStrip" )
{
animateArrows( target, amount, numFrames );
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment