Hmm in your original question:
Code:
return (dim[0] - dim[1]) * e.ims[i].jump / times + dim[1] + 'px';
Does the part in red return a fraction (between 0 and 1) that represents the degree of the final width of the image, where 0.1=10%, 1=100% etc? I can't tell easily the various parts of your equation above.
In general though the idea is for using the equation (1-Math.cos((i/100)*Math.PI)) / 2 in an animation is to repeatedly multiple that with the final image's width or height (ie: using setInterval) to get a portion of that final value so it gradually increases to the final value. Something like:
Code:
var curstep=0, totalsteps=100
var finalwidth=560 //final image width
var myanimate=setInterval(function(){
if (curstep<totalsteps){
myimage.style.width=(1-Math.cos((curstep/totalsteps)*Math.PI)) / 2 * finalwidth
curstep++
}
else
clearInterval(myanimate)
}, 10)
Totally untested, but I think you get the idea.
Bookmarks