I want my mesh uv animate ,hard to find example.
how to use UVAnimator to animate my mesh uv?Software: Away3D 4.x |
||
|
||
Richard Olsson, Administrator
Posted: 23 July 2012 07:59 AM Total Posts: 1192 [ # 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. |
||
Dentaku, Newbie
Posted: 19 January 2013 10:44 PM Total Posts: 8 [ # 2 ] Bit of an old topic, but I am trying the same thing. I used your provided solution Richard, but it throws the following error in AGALProgram3DCache.as:
warning: bad line 0: nullm44 vt7, vt0, vc0 I am using the latest away3D sourcecode from github. |
||
|
||
|
||
|