how to use UVAnimator to animate my mesh uv?

Software: Away3D 4.x

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

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

   

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:

warningbad line 0nullm44 vt7vt0vc0  
[Fault] exception
information=ErrorError #3647: AGAL validation failed: Temporary register read without being written to for source operand 1 at token 1 of vertex program. 

I am using the latest away3D sourcecode from github.

   

Vice, Member
Posted: 29 January 2013 03:05 PM   Total Posts: 58   [ # 3 ]

thanks, Richard for the good explanation. trying to use the uv animation and get the same error message. do you have an idea about this issue?

   

Mona, Newbie
Posted: 30 January 2013 01:48 AM   Total Posts: 6   [ # 4 ]

Richard.. you are good. It’s really comprehensive and detailed. You are the one who knows, and that’s what we need.

Vietnam travel-Halong bay cruise-Paradise cruise Halong bay

   

Vice, Member
Posted: 03 February 2013 09:49 AM   Total Posts: 58   [ # 5 ]

@Mona: Do you have made a test without the AGAL error?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X