Recipe 5.3. Adding Simple 3D Animation to FlashProblemYou want to animate 3D objects in Swift 3D for use in Flash. Figure 5-17. Knight with lathed baseSolutionUse drag-and-drop animations from the gallery toolbar and customize them with the timeline. DiscussionThere are two primary ways to add animation to a Swift 3D scene. If all you require are simple rotations and spins, most likely the preset Gallery Animations will fulfill your needs. The second method is manual keyframe animation, similar to that done within Flash. In either case, at the core of movement in Swift 3D is the animation timeline. Most likely if you are reading this book, you have at least a basic working knowledge of Flash and thus have some familiarity with a timeline. Although there are specific differences between the Swift 3D timeline workflow and that of Flash, the basic concept remains the same. Motion is defined through modifying aspects of an object at specific points (keyframes) in the timeline and the software generates the necessary frames in between these points. When an object is selected, the properties that are available for animation are reflected in the layers of the timeline. See Figure 5-20 to review the parts of the timeline. Figure 5-18. Setting depth for extruded elements of knight
Model objects, trackball lights, scene lights, scene cameras, and the perspective camera may all be animated, but there are some common properties that cannot be animated. Some of these include:
Here I'll provide a quick example of using the basic features of the timeline and animation gallery. The goal of the exercise is to animate the sunglasses shown in Figure 5-21. The planned animation will include the glasses spinning a full 360° horizontally along the x-axis while simultaneously folding the armatures to the closed position. During the process, object pivot points will be repositioned by manually animating with keyframes and applying a preset animation from the Gallery toolbar. Figure 5-21. Sunglasses model to be animatedThe first step is to organize the various part of the model for animation, forming parent/child relationships to make things easier. I have created relationships between the objects in the Hierarchy menu (see Figure 5-22) so that all parts of the glasses are under the influence of the parent named "Glasses." This step allows me to animate the entire model at one time. Below Glasses is another grouped relationship between the frames and the lenses, and finally two more additional children, one for each armature. This structure lets me apply animation to each armature without affecting the position of the overall model. To keep positioning simple, I will animate the armatures first, but before applying any changes, I first must reposition each arm's pivot point. Currently it is set to the center of the armature's mesh, and if I were to rotate the left arm, it would look similar to Figure 5-23. Not exactly what I had in mind. Figure 5-22. Parent/child relationships in the Hierarchy menuFigure 5-23. Example of rotating an object with incorrectly placed pivot pointConfirm that the Animate button is deactivated. After clicking Move Pivot Only, which is found under Position in the Properties Toolbar, use the mouse to reposition the pivot point so that it is located approximately where the hinge would be located. Doing this type of positioning requires working between the Top and Left viewports, and it often helps to switch over to wireframe view to remove visual obstacles. When in place and looking at the model through the Top viewport, check to see your progress by toggling on Lock Spin and giving the left arm a quick rotation with the trackball (see Figure 5-24). Figure 5-24. Example of rotating an object with the pivot point adjusted to the correct positionEverything appears to be in place, so undo the rotation and repeat the process to reposition the right arm's pivot point. After both are in place, it is time to start animating. With the Animate button in the active state, place the Current Frame Indicator at frame 30 and again rotate the left arm using the trackball and Lock Spin. Repeat for the right arm; the glasses are now folded shut. To make sure that the positioning is good, toggle off Animation Mode and switch to the Perspective view, rotating the camera to see how things look (see Figure 5-25). The positioning looks good; however, the animation preview shows that the meshes of the arms are actually coming into contact with one another and intersecting. It is always good to check an animation from multiple angles to detect problems such as this. To solve the issue of the overlapping mesh, reenter Animation Mode and select the right armature. After dragging the Start Frame handle in the Rotation layer to the fourth frame, the right arm has a slight delay before starting to close. This keeps it from hitting the left arm and the problem is solved, as shown in Figure 5-26. Now that the armature animations are completed, the final step is to apply the horizontal rotation to the glasses. Using the Top viewport, drag and drop the ERHorizontal Right animation to the Glasses group. When previewing the animation, two problems are evident right away. First, the spin finishes 10 frames before the armature animation. Second, the glasses extend off of the pedestal as they rotate. Figure 5-25. Final position of armatures in animationIn order to have the armature animation end with the rotation, select all in the Glasses group and drag the Timeline Scaling Bars to the 30th frame. To fix the problem of the glasses rotating off of the pedestal, reposition them to the center of the pedestal at the 30th frame. This fix will cause the glasses to move backward along the z-axis as they rotate. Setting the Stop Frame handle of the Position layer at frame 17 caused the glasses to move to the desired position before the animation was fully completed. Figure 5-27 shows every fifth frame of the animation. You should now have a good understanding of the animation timeline, the role that pivot points play, and structuring items in the Hierarchy menu. Armed with this basic knowledge, you will be able to apply it to create much more complex animations of your own. Figure 5-26. Adjusting start frame in the timeline to set a delay in the start of animationFigure 5-27. Every fifth frame in 30-frame animation of sunglasses rotating while folding |
Tripod >> 3pod Tips & Learning and manuals for educations