动画循环的基本语法?
例如,我知道 jQuery 可以制作各种动画。我还知道,在动画的核心,必须有某种循环来执行动画。这种循环的例子是什么?
理想情况下,完整的答案应该回答以下问题:
- 可以一次为特定对象的单个属性设置动画的有效动画递归的基本语法是什么?该函数应该能够改变其目标对象和对象的属性。
- 它应该采用什么参数/参数?
- 重复循环的最佳范围是多少?以毫秒为单位? (这应该是函数的参数/参数吗?)
请记住:
- 答案不一定是特定于语言的,但如果您使用特定语言编写,请指定是哪种语言。
- 错误处理是一个优点。 {没有什么比动画做一些奇怪的事情(比如中途停止)更令人恼火的了(就我们的目的而言)。}
谢谢!
I know that jQuery, for example, can do animation of sorts. I also know that at the very core of the animation, there must me some sort of loop doing the animation. What is an example of such a loop?
A complete answer should ideally answer the following questions:
- What is a basic syntax for an effective animation recursion that can animate a single property of a particular object at a time? The function should be able to vary its target object and property of the object.
- What arguments/parameters should it take?
- What is a good range of reiterating the loop? In milliseconds? (Should this be a parameter/argument to the function?)
REMEMBER:
- The answer is NOT necessarily language specific, but if you are writing in a specific language, please specify which one.
- Error handling is a plus. {Nothing is more irritating (for our purposes) than an animation that does something strange, like stopping halfway through.}
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常(至少对于 jQuery)这不是在循环中完成的,而是在一系列回调中完成的。
伪javascript:
也可以使用对象来存储起始数据而不是闭包。
这并没有完全回答问题中的所有要点,但它是一个起点。
typically (for jQuery at least) this is not done in a loop, but rather in a series of callbacks.
pseudojavascript:
It's also possible to use objects to store starting data instead of closures.
This doesn't completely answer all the points in the question, but it's a starting point.