Академический Документы
Профессиональный Документы
Культура Документы
Adobe Acrobat 3D
This tutorial shows how to use the provided script to easily control the playing of an animation in a 3D Scene. See Page 12 for an example of a finished product. With the script supplied in this tutorial, all aspects of an animation can be controlled with the javascript code. You can use Buttons, Events, or Mouse interactions to trigger the javascript code that controls the animation.
Play Selection
Rewind Selection Play and Advance
Play All
Stop
Rewind All
Animation Sections
Remove Float Bowl Screws Remove Float Bowl Remove Float Remove Top Cover Screws Remove Top Cover
Animation Control
How to create the example... 1. Obtain a 3D model with an embedded animation or create
one by following the Keyframe Animation tutorial. You can create animations using the Adobe 3D Toolkit that comes with Acrobat 3D. You can also create a very simple explode animation in the next step. If you already have a 3D model in your PDF, jump to Step 3.
Select the 3D Annotation and resize it so there is some blank space on the left side for buttons. Note: this will distort the preview image. Go back to the Edit Content dialog (Step 3) and select the Retrieve Poster from default View option and click OK.
Animation Control
5. Select the Button tool from the menu: Tools -> Forms
-> Button Tool. Add a button to the left of the 3D Annotation. Access its properties dialog by doubleclicking it or by Properties in its right-click menu. Under the Options tab, change the label to Play Selection.
Animation Control
Document Javascripts. Type AnimationControl or any similar name (its not important) in the Script Name text box and click Add. Delete the empty function that is created by default and paste the code on the following page into the script editor.
Animation Control
9.
Use the Select Text tool to copy this code. Note: This is also attached to this document as DocumentJavascripts.js.txt
(continued)
var AnimationSections = [[0,2],[2,5],[5,9]]; var SectionCount = AnimationSections.length; function Context() { return getAnnots3D(0)[0].context3D; } function Stop() { Context().MyAnimation.pause(); } function GetSelectedSectionIndex() { return getField("AnimationSections").currentValueIndices; } function SetSelectedSectionIndex(value) { value = Math.min(SectionCount-1, value); getField("AnimationSections").currentValueIndices = value; } function SetPlayRange(playall) { if(playall) { Context().MyAnimation.setPlayRange(AnimationSections[0][0], AnimationSections[SectionCount-1][1]); } else { var section = AnimationSections[GetSelectedSectionIndex()]; Context().MyAnimation.setPlayRange(section[0], section[1]); } } function PlaySelected(DontPlay) { SetPlayRange(); Context().MyAnimation.reset(); if(!DontPlay) Context().MyAnimation.play(); } function PlayAll(DontPlay) { SetPlayRange(true); SetSelectedSectionIndex(0); Context().MyAnimation.reset(); if(!DontPlay) Context().MyAnimation.play(); } function PlayNext(DontPlay) { SetPlayRange(); Context().MyAnimation.reset(); if(!DontPlay) Context().MyAnimation.play(); SetSelectedSectionIndex(GetSelectedSectionIndex() + 1); }
Animation Control
10.
Take a minute to observe the animation in your chosen 3D Model. Open the 3D Model in the 3D Toolkit and use the animation control at the bottom of the screen to start/stop/seek the animation. Decide how you might want to break it down into individual steps or sections. Scan the animation back and forth and write down the start and end time of each section you have decided on.
In the provided model, we use the following sections in the disassembly animation: Remove Float Bowl Screws - start:0 end:1 Remove Float Bowl - start:1 end:2 Remove Float - start:2 end:3 Remove Top Cover screws - start:3 end:4 Remove Top Cover - start:4 end:5
11.
Select the Document Javascripts menu from Step 9. Select the script you created and click Edit. Modify the AnimationSections variable declaration at the top; replace the [[0,1],[1,2],[2,3]] part with a similar list using the start and end times you decided on in the previous step. The values will end up making a list like this [[0,1],[1,2],[2,3],[3,4],[4,5]]. The line: "return getAnnots3D(0)[0].context3D;" might need to be changed if your 3D Annotation isn't on the first page of your PDF. Just change the first zero to the page number that your 3D annotation is on (page 1 = 0, page 2 = 1, page 3 = 2, ...)
Animation Control
12.
Select the Tools -> Forms - > ListBox Tool menu and create a listbox somewhere near your buttons. The Properties dialog should open as soon as its created. Navigate to the Options tab and add an item for each section of the animation you decided on in step 10. Note: Make sure they are in chronological order. Navigate to the General tab and change the Name to AnimationSections.
13.
Your PDF should now resemble Page 2 of this document (with the exception of the section titles and 3D Model) and should function in the same manner. Try experimenting with more buttons using other functions that the script contains. The rest of this document is a reference for the "Animation Controller.js" javascript.
Animation Control
AnimationController.pause() Freeze the animation at the current position. Calling play() afterward will resume the animation right where it left off. AnimationController.reset() Stops the animation and resets the position to the beginning or the end (depending on the last call to setPlayForward()). AnimationController.setPlayForward(forward) Sets the play direction but doesnt start playback. forward = true: Play the animation in the normal forward direction (default) forward = false: Play the animation in the opposite direction AnimationController.setLoop(loop) Sets the looping mode but doesnt start playback. loop = true: Play the animation in looped mode loop = false: Play the animation once and then stop (default) AnimationController.setPingPong(ping) Turns pingpong on or off but doesnt start playback. Note: When ping = true, this will override the setPlayForward() function. Note: This can be used with setLoop() Play the animation forward once, and then backward once ping = true: ping = false: Play the animation once in the direction specified with setPlayForward()
Animation Control
Note: There are get functions for most of the above parameters, i.e. getPlaySpeed(), getSmoothness(), getPingPong(), ...
Animation Control
Materials and/or Tutorial prepared by Daniel Beardsley (4/22/2006) Copyright 2006 Adobe Systems Inc no full or partial reproduction of this document is permitted without prior written permission of Adobe Systems
Animation Control
2 Removing the Bowl 2.1 2.2 Remove the screws holding on the bottom of the carburetor (the bowl) Remove the bowl and be careful not to get any debris inside the carburetor. Note: (residual gasoline may still be inside the carburetor and will probably spill at this point) Gently pull out the floats and the pivot bar they are attached to.
2.3
3 Removing the Mixing Cover 3.1 Remove the screws that hold the top part of the carburetor on (The Mixing Cover). Remove the mixing cover itself by sliding it vertically until the assembly is clear of the carburetor. Note: Assembly is the reverse of disassembly.
3.2