这应该很容易,但由于某些原因,我总是错误地接近它。
我需要递增一个基数,从1到无穷大。
我有一个以毫秒为单位的数字,表示动画的持续时间,从750开始。我有另一个数字,表示我们跳过的元素的数量。
var animationDuration = 750;
var difference = Math.abs(currentPanelIndex - target); //somewhere from 1 - X我需要为每个不同的数字递增animationDuration。
发布于 2011-10-11 04:55:32
解决方案:
目标(currentPanelIndex-Math.abs)给出了我们的差值(animationDuration / 10),给出了标准持续时间的1/10的增量
因此: var currentDuration = Math.abs(currentPanelIndex - target) * (animationDuration / 10) + animationDuration;
发布于 2011-10-08 07:42:47
animationDuration = difference * increment ??https://stackoverflow.com/questions/7693820
复制相似问题