how to use UVAnimator to animate my mesh uv?

how to use UVAnimator to animate my mesh uv?

Software: Away3D 4.x

datouaizi, Member
Posted: 20 July 2012 02:44 PM   Total Posts: 92 

I want my mesh uv animate ,hard to find example.

   

Richard Olsson, Administrator
Posted: 23 July 2012 07:59 AM   Total Posts: 1190   # 1 ] 

First of all, note that UV animation is a way to animate UV transforms through interpolating between a set of keyframes. They’re great for creating streams of water, for example, but if you’re looking to create spritesheet animation you will need to implement a very basic UV transform update code of your own. Interpolating between frame states in spritesheet animation would not work (because you would sometimes end up right between two frame sprites.)

That said, here’s a basic rundown of how you create and use UV animation:

Create UV frames (UVAnimationFrame) representing the various keyframe states in your animation. Set their offsetU, offsetV, scaleU, scaleV and rotation properties.

Create a UVClipNode and add your frames to it using addFrame(), passing in the frame object and the duration. The UVClipNode basically represents a “pre-recorded” UV animation with keyframes.

Create a UVAnimationState, passing in your UVClipNode instance as the root node argument to the constructor. The animation state represents the current state of the animation, which is constructed for any set of nodes. In this case, the clip node will “feed” the current state with the UV transformation matrix to be used to perform the UV transformation of the current (interpolation of) frames.

Next create an instance of UVAnimationSet, and add your state to it using the addState() method. While invoking that method, also give your state a name by passing it into the name argument. For example, call it “myanim”.

Finally, create a UVAnimator, and pass in the animation set. Assign the animator to the Mesh.animator and invoke animator.play(“myanim”) to play the animation you created.

转载于:https://www.cnblogs.com/DavidFan/archive/2012/11/15/2770847.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值