






















how to use UVAnimator to animate my mesh uv?Software: Away3D 4.x | ||
datouaizi, Member I want my mesh uv animate ,hard to find example. | ||
Richard Olsson, Administrator 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. |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。