使用 tweenlite 补间 3d 坐标
我正在尝试使用 AS3 将精灵补间为新的 3D 坐标 (x,y,z),我想使用 TweenLite 来完成此操作,但我不知道如何操作?
我不是一个非常有经验的程序员,我只是开始解决 flash 10 的 3d 可能性,到目前为止,Tweenlite 对我的动画确实很有帮助。
我一直在尝试像这样使用 QuaternionsPlugin:
TweenLite.to(myMc, 2, {quaternions:{orientation:new Quaternion(x, y, z, w)}});
有 x,y,z 属性,但我无法弄清楚 w 代表什么。 我尝试了下面的 Sprite 类的示例,但是当我编译它时,它显示: 1180: 调用可能未定义的方法四元数。
package com{
import flash.display.*;
import flash.events.*;
import com.greensock.TweenLite;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.QuaternionsPlugin;
TweenPlugin.activate([QuaternionsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.
public class Carousel extends Sprite {
public function Carousel():void {
}
public function scrollUp():void{
TweenLite.to(Mc1, 2, {quaternions:{orientation:new Quaternion(246, 244, 0, 400)}});
TweenLite.to(Mc2, 2, {quaternions:{orientation:new Quaternion(242, 210, 70, 353)}});
}
public function scrollDown():void{
TweenLite.to(Mc1, 2, {quaternions:{orientation:new Quaternion(242, 290, 60, 360)}});
TweenLite.to(Mc2, 2, {quaternions:{orientation:new Quaternion(246, 244, 0, 400)}});
}
}
感谢
您的任何提示/帮助,真的!
im trying to tween a sprite to new 3D coordinates (x,y,z) using AS3 and i would like to use TweenLite to do it but i don't know how?
Im not a very experienced programmer, i only started to tackle the 3d possibilities of flash 10 and Tweenlite has been really helpful so far for my animations.
I've been trying to use the QuaternionsPlugin like this:
TweenLite.to(myMc, 2, {quaternions:{orientation:new Quaternion(x, y, z, w)}});
There's the x,y,z properties but i couldn't figure out what w stand for.
I tried an example with the Sprite class below but when i compile it, it says : 1180: Call to a possibly undefined method Quaternion.
package com{
import flash.display.*;
import flash.events.*;
import com.greensock.TweenLite;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.QuaternionsPlugin;
TweenPlugin.activate([QuaternionsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once.
public class Carousel extends Sprite {
public function Carousel():void {
}
public function scrollUp():void{
TweenLite.to(Mc1, 2, {quaternions:{orientation:new Quaternion(246, 244, 0, 400)}});
TweenLite.to(Mc2, 2, {quaternions:{orientation:new Quaternion(242, 210, 70, 353)}});
}
public function scrollDown():void{
TweenLite.to(Mc1, 2, {quaternions:{orientation:new Quaternion(242, 290, 60, 360)}});
TweenLite.to(Mc2, 2, {quaternions:{orientation:new Quaternion(246, 244, 0, 400)}});
}
}
}
Thanks for any hint/help, really!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Quanternion 对象来自 PaperVision3D 的数学课。 “w”代表旋转角度,四元数保证最有效的旋转路径。
Vector3D 对象具有 w 属性。 Matrix3D 的插值() 方法使用四元数,因此您可以使用 Matrix3D 的 intropolate() 或 transformVector() 方法,或者您可以简单地调整显示对象的 x、y 和 z 属性 - 假设您不这样做需要绝对最高效的渲染。
the Quanternion object is from PaperVision3D's math class. "w" is for the angle of rotation and a quaternion guarantees the the most efficient path for the rotation.
Vector3D objects have w properties. Matrix3D's interpolate() method uses quaternions, so you could tween using Matrix3D's intropolate() or transformVector() methods, or you could simply tween the x, y, and z properties of your display object - assuming you don't require the absolute most efficient rendering.