Keywords include portable animation animating embed animate d in line graphics vector graphics graphics 64257les LaTeX dvip s ps2pdf pdfLa TeX PDF JavaScript PSTricks pgf TikZ LaTeXpicture Adobe Reader Contents 1 Introduction 2 Requirements 3 Insta ID: 51924
Download Pdf The PPT/PDF document "The animate Package Alexander Grahn th M..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
TheanimatePackageAlexanderGrahn 4thMay2007AbstractALATEXpackageforcreatingportable,JavaScriptdrivenPDFanimationsfromsetsofgraphicslesorinlinegraphics.Keywords:include,portable,animation,animating,embed,animated,in-linegraphics,vectorgraphics,graphicsles,LaTeX,dvips,ps2pdf,pdfLa-TeX,PDF,JavaScript,PSTricks,pgf,TikZ,LaTeX-picture,AdobeReaderContents1Introduction22Requirements23Installation24Usingthepackage25Theuserinterface36Examples56.1Animationfromasetofles,using`animategraphics'command.56.2AnimatingPSTricksgraphics,using`animateinline'environment67Bugs78Acknowledgements81 1IntroductionThispackageprovidesaninterfacetocreatePDFswithanimatedcontentfromsetsofgraphicsles,frominlinegraphics,suchasLATEX-picture,PSTricksorpgf/TikZgeneratedpictures,orjustfromtypesettext.Unlikestandardmovie/videoformats,whichcanbeembedded,forexample,usingtheLATEXpackage`movie15'[1],package`animate'allowsforanimatingvectorgraphics.TheresultisroughlysimilartotheSWF(Flash)format,althoughnotasspace-ecient.Package`animate'supportstheusualPDFmakingworkows,i.e.pdfLATEXandLATEX!dvips!ps2pdf(Ghostscript).ThenalPDFcanbeviewedincurrentAdobeReader®sonallsupportedplat-forms.The`animate'packagemakesuseofOptionalContentGroups(OCG),alsoknownasPDFlayers,whichisafeatureprovidedbythePDF-1.5specication.EachframeofananimationisassociatedwithanOCGthatismadevisibleorinvisibleinadynamicfashionbymeansofAdobeReader'sbuilt-inJavaScriptengine.2Requirementspdf"TEX,version1:20forPDFoutputAdobeReader,version63InstallationThele`animate.sty'shouldbestoredinaplacewhereLATEXcanndit.4UsingthepackageFirstofall,readSection7onproblemsrelatedtothispackage.Then,invokethepackagebyputtingtheline\usepackage[packageoptions-4.9;ç¥]{animate}tothepreambleofyourdocument,i.e.somewherebetween\documentclassand\begin{document}.`animate'honoursthepackageoptions:autoplayautopauseautoresumecontrolsbuttonsize=size-4.9;è·2 looppalindromescreenbg=colour-4.9;ç¥buttonbg=colour-4.9;ç¥stepposter=[first|none|last]Thesameoptionsarealsoavailableascommandoptionsandwillbeexplainedshortly.However,ifusedaspackageoptionstheyhaveglobalscope,takingeectonallanimationsinthedocument.IfPDFisgeneratedviaDVIandPostscriptbythecommandsequencelatex!dvips!ps2pdf,the`graphicx'packageisrequired.Important:Thedvipsoption`-Ppdf'shouldnotbesetwhenconvertingtheintermediateDVIintoPostscript.Ifyoucannotdowithout,put`-X2400-Y2400'after`-Ppdf'onthecommandline.5TheuserinterfacePackage`animate'providesthecommand\animategraphics[options-4.9;ç¥]{framerate-4.9;ç¥}{filebasename-4.9;ç¥}{first-4.9;è}{last.07;ç }andtheenvironment\begin{animateinline}[options-4.9;ç¥]{framerate-4.9;ç¥}...typesetmaterial...\newframe...typesetmaterial...\newframe*...typesetmaterial...\end{animateinline}While\animategraphicscanbeusedtoassembleanimationsfromsetsofex-istinggraphicsles,theenvironment`animateinline'isintendedtocreatetheanimationfromthetypesetmaterialitencloses.ThismaterialcanbepicturesdrawnwithintheLATEXpictureenvironmentorusingtheadvancedcapabili-tiesofPSTricksorpgf/TikZ.Evenordinarytextualmaterialmaybeanimatedinthisway.Thecommand\newframeterminatesaframeandstartsthenextone.Thereisastarredversion,\newframe*.Ifplacedafteraparticularframeitcausestheanimationtopauseatthatframe.Theanimationcontinuesnormallyafterclickingitagain.Theparameterframerate-4.9;è·speciesthenumberofframespersecondoftheanimation.Alllesofthesequencemustbeconsecutivelynumbered.filebasename-4.9;ç¥istheleftmostpartofthelenamethatallmembersofthesequencehaveincommon.first-4.9;ç¥isthenumberoftherstandlast-4.9;ç¥thenumberofthelastleintheset.first-4.9;ç¥andlast-4.9;ç¥musthavethesamenumberofdigitstoensurepropersorting.Ifnecessary,renametheleswithzerospaddedtotheleft.3 Thereisnolenameextensiontobespeciedasparameter.ThepossibleleformatsdependonwhetherLATEXorpdfLATEXisused.InthecaseofLATEX,leswiththeextension`eps'aresearchedforatrst,followedby`mps'(METAPOST-generatedPostscript)and`ps'.WithpdfLATEXthesearchingorderis:(1)`pdf',(2)`mps',(3)`png',(4)`jpg',(5)`jpeg',(6)`jbig2'and(7)`jb2'.Thatis,lescapabletostorevectorgraphicsarefoundrst.Makesurethatalllenameshavelowercaseextensions.Forexample,giventhesequence`frame_05.png'through`frame_19.png'fromapossiblylargersetthatshallbeusedtobuildtheanimation.Then,filebasename-4.9;ç¥wouldbespeciedas`frame_',first-4.9;ç¥as`05'andlast-4.9;ç¥as`19'.Thefollowingoptionsto\animategraphicsand`animateinline'havebeenprovided:autopausePauseanimationwhenthepageisclosed,insteadofstoppingandrewindingittothedefaultframe.autoplayStartanimationafterthepagehasopened.Alsoresumesplaybackofapreviouslypausedanimation.autoresumeResumepreviouslypausedanimationwhenthepageisopenedagain.loopTheanimationrestartsimmediatelyafterreachingtheend.palindromeTheanimationcontinuouslyplaysforwardandbackward.controlsInsertscontrolbuttonsbelowtheanimationwidget.Themeaningofthebuttonsisasfollows,fromlefttoright:stop&rstframe,stepbackward,playbackward,playforward,stepforward,stop&lastframe,decreasespeed,defaultspeed,increasespeed.Both`play'buttonsarereplacedbyalarge`pause'buttonwhiletheanimationisplaying.width=width-4.9;è·height=height-4.9;ç¥depth=depth-4.9;è·Resizetheanimationwidget.AnyvalidTEXdimensionisacceptedasparameter.Option`depth'specieshowfartheanimationwidgetshouldextendbelowthebottomlineoftherunningtext.Ifonlyoneoftheseoptionsisgiven,theothersarescaledtokeeptheaspectratio.4 scale=factor-4.9;è·Scalestheanimationwidgetbyfactor-4.9;ç¥.buttonsize=size-4.9;è·Changesthecontrolbuttonheighttosize-4.9;ç¥,whichmustbeavalidTEXdi-mension.Thedefaultbuttonheightis1.44emandthusscaleswiththecurrentfontsize.screenbg=colour-4.9;ç¥buttonbg=colour-4.9;ç¥Thebackgroundoftheanimationandcontrolbuttonwidgetsistransparentbydefault.Itcanbeturnedintoasolidcolourbytheparametercolour-4.9;ç¥,whichisanarrayofnumbers(withoutsurroundingbrackets)intherangefrom0.0to1.0.Thenumberofarrayelementsdeterminesthecolourmodelinwhichthecolourisdened:(1)grayvalue,(3)RGB,(4)CMYK.stepStepthroughtheanimationbyoneframepermouse-click.poster=[first|none|last]Specieswhichframe(rst,lastornone)todisplayandprintiftheanimationisnotactivated.Option`poster=rst'neednotbeexplicitlysetbecauseitisthedefault.6Examples6.1Animationfromasetofles,using`animategraphics'command\documentclass{article}\usepackage{animate}\usepackage{graphics}\begin{document}\begin{center}\animategraphics[controls,loop]{4}{frame_}{0}{8}\end{center}\end{document}5 6.2AnimatingPSTricksgraphics,using`animateinline'environment\documentclass{article}\usepackage{pst-3dplot}\usepackage{fp}\usepackage{animate}%drawsatorussector\newcommand{\torus}[1]{%#1:angleofthetorussector\psset{Beta=20,Alpha=50,linewidth=0.1pt,origin={0,0,0},unit=0.35}%\begin{pspicture}(-12.3,-6.3)(12.3,7)%\parametricplotThreeD[xPlotpoints=100](80,#1)(0,360){%tcos2mul4usin2muladdmultsin2mul4usin2muladdmulucos4mul}%\parametricplotThreeD[yPlotpoints=75](0,360)(80,#1){%ucos2mul4tsin2muladdmulusin2mul4tsin2muladdmultcos4mul}%\FPupn\strokewidth{360#1sub360div3mul}%\parametricplotThreeD[yPlotpoints=1,linewidth=\strokewidthpt](0,360)(#1,#1){%ucos2mul4tsin2muladdmulusin2mul4tsin2muladdmultcos4mul}%\end{pspicture}%}\begin{document}\begin{center}\newcounter{torusangle}\setcounter{torusangle}{80}6 \begin{animateinline}[poster=last,controls,palindrome]{10}%\torus{\thetorusangle}%\whiledo{\thetorusangle360}{%\newframe%\addtocounter{torusangle}{10}%\torus{\thetorusangle}%}\end{animateinline}%\end{center}\end{document} 7BugsThecommand\multidoanditsrelativesfrompackage`multido'donotworkiftheloopbodycontains\newframe.Use\whiledofrompackage`ifthen'instead.Acountermustbedeclaredtokeeptrackofthenumberofiterations.Furthervariablesthattakexedpointdecimalstobeusedwithintheloopbodycanbedenedandincrementedbymeansofthecommands\FPsetand\FPaddfrompackage`fp'.Forexample:%declareloopcounter\newcounter{iter}%\begin{animateinline}{12}%initializeloopcounter\setcounter{iter}{0}%%definesomevariable,e.g.`\somevar'\FPset{\somevar}{1.0}%%makecopy`\varcopy'of`\somevar'withglobalscope\xdef\varcopy{\somevar}%......createfirstframeusing\somevar(=1.0)...(\multido_can_beusedhere!)...\whiledo{\theiter50}{%do50iterations7 %startnewframe\newframe%%incrementloopcounterby1\addtocounter{iter}{1}%%increment\somevarby,e.g.,0.5\FPadd{\somevar}{\varcopy}{0.5}%%refreshthecopy\xdef\varcopy{\somevar}%......createframeusing\somevar...(\multido_can_beusedhere!)...}\end{animateinline}Currently,animationscannotbeplacedonmultilayeredslidescreatedwiththeBeamerclass.Putanimationsonatslidesonly.(Ofcourse,slideswithoutanimationsmaystillhaveoverlays.)Thedvipsoption`-Ppdf'shouldbeavoidedentirelyorfollowedby`-X2400-Y2400'onthecommandlineinordertosetasensibleDVIresolution.IntimesofType-1fonts,thisdoesnotdegradetheoutputquality!Thecongurationle`config.pdf'loadedbyoption`-Ppdf'speciesanex-cessivelyhighDVIresolutionthatwillbepassedontothenalPDF.Eventually,AdobeReadergetsconfusedandwillnotdisplaytheframeswithintheanimationwidget.Animationswithcomplexgraphicsand/ormanyframesmaycauseLATEXtofailwitha`TeXcapacityexceeded'error.EnlargeTEX'smemorywithcommandlineoption`--mem-max=...'.Originally,package`animate'wasbasedonamethodsuggestedbyJanHole£ekandPetrSoika[2],butwasrewrittentouseOptionalContentGroups(OCG).OCG-basedanimationsarefullysupportedinAdobeReader8,buthavesomeperformanceissues.PlaybackisusuallyslowerinReader8thaninolderReaderversions,whichisprobablyabug.Thenon-OCGapproachperformsbetterinAdobeReader8,butpackage/commandoptions`autoplay',`autopause'and`autoresume'donotwork.Moreover,theanimationpositionandtheplay/pause'buttonsarenotproperlyresetonpagechange.ThisisduetousagerestrictionsthatAdobeimposedonsomeimportantJavaScriptmethodsinReader8.Anon-OCGversionofthepackageisstillavailableas`animate-noocg.sty'.8AcknowledgementsIwouldliketothankFrançoisLafontwhodiscoveredquiteafewbugsandmademanysuggestionsthathelpedtoimprovethefunctionalityofthepackage.8 References[1]TheMovie15Package.URL:http://www.ctan.org/tex-archive/macros/latex/contrib/movie15[2]Hole£ek,J.;Sojka,P.:AnimationsinpdfTEX-generatedPDF.In:LectureNotesinComputerScience,Vol.3130,2004,pp.1791919