[英]how can i throttle animations, e.g. set them based on pinch gesture scale
I'm using velocity.js to animate css properties. 我正在使用Velocity.js为CSS属性设置动画。
$(".list-element).velocity({
height: "50px"
}, {
duration: 250
})
I would like to change the same properties to the same target value based on dynamic events as well. 我也想根据动态事件将相同的属性更改为相同的目标值。
Especially pinch gesture (hammer.js) and scrolling. 特别是捏手势(hammer.js)和滚动。
For that i would need some way to tell velocity that i only want a subset of the full animation. 为此,我需要某种方式告诉速度我只需要完整动画的一个子集。 For example setting it to 10% of the full animation.
例如,将其设置为整个动画的10%。
Splitting the full animation into x small parts would break the easing i think. 我认为,将整个动画分成x个小部分会破坏缓动性。
your question is very general! 您的问题很笼统!
i don't get exactly what you want! 我没有得到你想要的!
but in Velocity you can use function instead of certain value, like this: 但是在Velocity中,您可以使用function而不是某些值,例如:
var step = 10; //consider it's dynamic variable!
$elm.velocity({
height: function() {
return '+='+(step/100)*300+'px';
}
},whatEver);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.