在 Actionscript 3 中调整对象的宽度而不移动对象
我正在尝试对 MovieClip 对象的宽度属性应用补间,但每次它也会更改宽度和位置,而我不希望这样。我想更改一侧的宽度而不更改对象的 x 和 y。
我尝试了这两种方法,但它们给出了相同的结果。
var c:Tween = new Tween(left, "scaleX", Strong.easeOut, 1, 1.5,20,true);
var c:Tween = new Tween(left, "width", Strong.easeOut, 20, 200,20,true);
我认为它是根据影片剪辑的中心应用变换。但我不知道如何改变它。
有什么帮助吗?
I am trying to do a apply a tween for the width property on a MovieClip Object but every time it changes the width and the position too, and I don't want that. I want to change the width going to one side without changing the x and y of the object.
I tried both of thes and they gave the same result.
var c:Tween = new Tween(left, "scaleX", Strong.easeOut, 1, 1.5,20,true);
var c:Tween = new Tween(left, "width", Strong.easeOut, 20, 200,20,true);
I think it is applying the transformation according to a center of the movie clip. but I don't know how it can be changed.
any help ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的问题是您没有正确绘制影片剪辑,并且它的边界框不是从 x,y, 0 开始;
你能做什么
1. 修复影片剪辑,使图形位于 0,0 位置。
或者
2. 将“左”对象放在另一个对象内,位置为 0,0 并按比例缩放。
或者
3.当调整大小动画工作时,您也可以按比例移动x坐标
其中 delta 是影片剪辑中图像的偏移量。
Your problem is fact that you don't draw your movie clip correctly and it's bounding box dont start from x,y, 0;
what you can do
1. fix movie clip to have graphics in 0,0 position.
or
2. put your "left" object inside another object at position 0,0 and than scale.
or
3. you can proportionally move the x coordinate also while re size animation is working
where delta is offeset of your image inside movie clip.
首先,避免使用默认的 Tween 引擎。有更好的替代方案(这是主要原因,默认的 Tween 引擎很长一段时间没有受到平台开发人员的任何关注)。有些可能性可能可以在这里找到,或者通过网络找到。
是的,事实上,该对象在补间宽度时改变位置,表明它的注册点不在相对于该对象的坐标 0 上。解决方案是:
如果有可能,请更改对象的注册点。也许通过 Flash IDE 或以编程方式放置组件,例如相对于对象的注册点将位于 0。
每次迭代,将其右移扩展值的一半。
这个小片段解释了,将其转换为补间应该很容易:
请记住,只有当注册点位于对象的死点(x 轴上)时,这才有效。
First of, shy away from the default Tween engine. There are way better alternatives for that (that's the main reason, the default Tween engine hasn't received any attention from the platform devs in a long while). Some possibilities may be found here, or over the web.
Yes, the fact, that object changes position, when tweening the width of it, shows that it's registration point is not on coordinate 0 relative to that object. The solutions are:
If you have the possibility, change the object's registration point. Maybe via Flash IDE or programatically lay down components, such as the reg point would be at 0, relative to the object.
Shift it right by half the expansion value, every iteration.
This little snippet explains that, translating it into tweens should be easy:
Bear in mind, this only works well, if the registration point is on the dead center (on x axis) on the object.