简体   繁体   English

我如何限制动画,例如根据捏合手势比例设置它们

[英]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.

相关问题 Javascript - 如何在方法中获取/设置? (例如 pineapple.is_a.fruit) - Javascript - How do I have a get/set in a method? (e.g. pineapple.is_a.fruit) 我可以分配对象运算符吗? “例如+,-” - Can I assign Objects operators? “e.g. +, -” 如何生成特定颜色的随机阴影列表? (例如橙色的随机阴影) - How can I generate a list of random shades of a particular color? (e.g. random shade of orange) 如何在PHP中使用Ajax从网站(例如IMDB)中获取数据 - How can I fetch data from a website (e.g. IMDB ) using Ajax in PHP 如何使用 kotlin JS 测试 UI? (例如在页面上有一个元素) - How can I test UI with kotlin JS? (e.g. have an element on a page) 当用户输入特殊字符时如何显示菜单或下拉列表,例如 % - How can I have display a menu or dropdown list when user enters a special character e.g. % 如何使我的 CSS 切换 state 变化更平滑,例如通过过渡? - How can I make my CSS toggle state changing smoother e.g. with a transition? EJS:我怎样才能让我的内容占据整个屏幕(例如宽度:100%)? - EJS: How can I make my content take up the whole screen (e.g. width: 100%)? 我如何渲染列表中的 2 个玩家,他们有相同的点数,处于相同的水平,例如第二个? - How can I render 2 players of a list, that have the same points, at the same level, e.g. both second? 如何使用正则表达式获取特定字符后的所有字符,例如逗号(“,”) - How can I use regex to get all the characters after a specific character, e.g. comma (“,”)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM