ActionScript 3 - 使用 Tween 类补间数字
目前,我正在使用 Tween 类补间数字,方法是将其值添加到对象的项目数组中:
var tweenObject:Object = {value:20};
distanceTween = new Tween(tweenObject, "value", None.easeNone, 0, tweenObject.value, 5, true);
这是使用 Tween 类补间数字的最常见、最简单的方法吗?
我知道其他补间类有更简单的解决方案,但我只关心默认的补间类。
currently i'm tweening numbers with the Tween class by adding their value to an object's items array:
var tweenObject:Object = {value:20};
distanceTween = new Tween(tweenObject, "value", None.easeNone, 0, tweenObject.value, 5, true);
is this the most common, simple way to tween numbers with the Tween class?
i'm aware there are more simple solutions with other tween classes, but i'm only concerned with the default Tween class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Tween 应该与对象的任何公共变量一起使用,以便您可以在类上定义公共属性并使其工作。默认情况下,时间轴上的变量是公共的,因此如果您不在班级中,您只需按名称引用这些变量即可。我也认为你所做的事情没有问题,所以如果你对此感到满意,那么就不要太担心。
所以在主时间线上:
或者在课堂上:
我强烈建议你学习使用一个好的补间引擎,比如 Tween、TweenLite 或 gTween 因为它们可以在更清晰的界面中为您提供更大的灵活性。
Tween should work with any public variables of an object so you can define a public property on your class and have it work. By default variables on the timeline are public so you can just refer to those by name if you aren't inside a class. I also see no problem with what you are doing so if you are happy with it then don't worry too much about it.
So on the main timeline:
Or insides a class:
I'd strongly urge you to learn to use a good tween engine like Tweener, TweenLite or gTween since they can give you a lot more flexibility within a much saner interface.