/
The animate Package Alexander Grahn th March  Abstract The animate Package Alexander Grahn th March  Abstract

The animate Package Alexander Grahn th March Abstract - PDF document

liane-varnes
liane-varnes . @liane-varnes
Follow
397 views
Uploaded On 2015-04-19

The animate Package Alexander Grahn th March Abstract - PPT Presentation

Keywords include portable PDF animation animated PDF animating embed animated graphics LaTeX pdfLaTeX LuaLaTeX PSTricks p gf TikZ LaTeXpicture MetaPost inline graphics vector graphi cs animated GIF LaTeX dvips ps2pdf dvipdfmx XeLaTeX JavaScript Ado ID: 51923

Keywords include portable

Share:

Link:

Embed:

Download Presentation from below link

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.


Presentation Transcript

Important: G~~=4G ==1 ==2 ==3 ==4 ==5 ==6 ==7 ==8 Play/Pause 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M 2lP Q M ax cos2 O A B C D xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz 40 44 48 52 46 60 66 72 80 88 96 104 112 120 132 144 160 176 192 208 42 46 50 54 58 63 69 76 84 92 100 108 116 126 138 152 168 184 GRAVELARGOLENTOADAGIOLARGETTOANDANTEANDANTINOMODERATOALLEGRETTOALLEGROVIVACEPRESTOPRESTISSIMO TheanimatePackageAlexanderGrahn * https://gitlab.com/agrahn/animate https://gitlab.com/agrahn/animate 7thOctober2020AbstractALaTeXpackageforcreatingportable,JavaScriptdrivenPDFandSVGanimationsfromsetsofvectorgraphicsorrasterimagelesorfrominlinegraphics.Keywords:includeportablePDFanimationSVGanimationanimatedPDFanimatedSVGdvisvgmhtmlTeX4htwebanimatingembedanimatedgraphicsLaTeXpdfLaTeXLuaLaTeXPSTrickspgfTikZLaTeX-pictureMetaPostinlinegraphicsvectorgraphicsanimatedGIFLaTeXdvipsps2pdfdvipdfmxXeLaTeXJavaScriptAcrobatReaderKDEOkularPDF-XChangeFoxitReaderFirefoxChromeChromiumContents1Introduction 2 2 2Requirements 2 2 3Installation 3 3 4Usingthepackage 3 3 5Theuserinterface 4 4 6Commandoptions 7 7 6.1Basicoptions................................ 7 7 6.2The`timeline'option.......................... 10 10 7Programminginterface 15 15 8Examples 17 17 8.1Animationsfromsetsofles,using\animategraphics....... 17 17 8.2AnimatingPSTricksgraphics,using`animateinline'environment. 20 20 9AnimatedSVG 26 26 *AnimatedGIFtakenfrom phpBB phpBB forumsoftwareandburstintoasetofEPSlesusing ImageMagick ImageMagick beforeembedding.1 10Bugs 28 28 11Acknowledgements 29 29 1IntroductionThispackageprovidesaninterfaceforcreatingPDFandSVGleswithanimatedcontentfromsetsofgraphicsorimageles,frominlinegraphics,suchasLATEX-picture,PSTricksorpgf/TikZgeneratedpictures,orjustfromtypesettext.Unlikestandardmovie/videoformats,package`animate'allowsforanimatingvectorgraphics.TheresultisroughlysimilartotheSWF(Flash)format,althoughnotasspace-ecient.Package`animate'supportstheusualworkowsformakingPDF,i.e.pdfLATEX,Lua-LATEX,LATEXEdvipsEps2pdf/Distillerand(XE)LATEXE(x)dvipdfmx.Foranim-atedSVG,itsupportsthedvisvgmdriver.TheDVI/XDVusedasinputfordvisvgmcanbegeneratedwithLATEX,LuaLATEX(inDVImodewithcommand`dvilualatex')andXELATEX(withoption`--no-pdf').PDFleswithanimationscanbeviewedinAcrobatReader(exceptonmobiledevices),KDEOkular,PDF-XChangeandFoxitReader.AnimatedSVGproducedbymeansofLATEXanddvisvgmareself-sucientlesthatcanbeembeddedintoHTMLusingtheobject&#x-5.1;ूtagoropeneddirectlyinaWebbrowser,suchasChromiumorFirefox.Also,presentations,suchas`beamer'-classdocuments,withembeddedanimationscanbeexportedtoSVGinsteadofPDFandviewedinaWebbrowser.SVG-capableWebbrowsersarestandardonmanyplatformsandoperatingsystemsandthusmakeSVGaveryportableleformat.ALATEXpackageforembeddingvideoandaudiointoSVGisalsoavailable[ 6 6 ].Theuserinteractswiththeanimationthroughoptionalanimationcontrolsorusingthemouselikeso:pressingthemousebuttonovertheanimationwidgetimmediatelypausesaplayinganimationandreleasingitresumesplayback.Pressingtheshift-keyatthesametimereversestheplaybackdirection.Keepingthemousebuttonpressedwhilemovingthemousepointerotheanimationwidgetpermanentlypausesplay-back.Onmobiledevices,tappingontheanimationtogglesbetweenplayandpause.2RequirementspdfTEX,versionx1:40,orLuaTEX,versionx0:95,fordirectPDFoutputGhostscript,versionx9:15,orAdobeDistillerforPStoPDFconversiondvipdfmxforDVItoPDFconversiondvipdfmx,versionx20190503,forDVItoPDFconversiondvisvgmforDVItoSVGconversion(alsorequiresGhostscript)PDF:AcrobatReader,KDEOkular,PDF-XChange,FoxitReaderSVG:Chromium-basedbrowsersforbestperformance2 3InstallationUnzipthele `animate.tds.zip' `animate.tds.zip' intothelocalTDSrootdirectorywhichcanbefoundbyrunning`kpsewhich-var-valueTEXMFLOCAL'onthecommandline.Afterinstallation,updatethelenamedatabasebyrunning`texhash'onthecom-mandline.TEX-LiveandMiKTEXusersshouldrunthepackagemanageroftheirsystemforin-stallation.4UsingthepackageFirstofall,readSection 10 10 onproblemsrelatedtothispackage.Then,invokethepackagebyputtingtheline\usepackage[packageoptions&#x-5.1;ू]{animate}tothepreambleofthedocumentsource,i.e.somewherebetwee\documentclassand\begin{document}.`animate'honoursthepackageoptions:dvipdfmxxetexdvisvgmexportautoplayautopauseautoresumelooppalindromedraftfinalcontrols[=(all|true|on)|(none|false|off)|{[play][,step][,stop][,speed]}]controlsaligned=left[+indent.95;≀]|center|right[+indent&#x-5.1;ू]width=h-size&#x-5.1;ूheight=v-size&#x-5.1;à  |totalheight=v-size&#x-5.1;ूkeepaspectratioscale=factor&#x-5.1;ूbb=llx&#x-5.1;à  lly&#x-5.1;ूurx&#x-5.1;ूury&#x-5.1;ूviewport=llx&#x-5.1;à  lly&#x-5.1;ूurx&#x-5.1;ूury&#x-5.1;ूtrim=left&#x-5.1;à  bottom&#x-5.1;ूright&#x-5.1;ूtop&#x-5.1;ूcliphiresbbinterpolatepagebox=...buttonsize=size&#x-5.1;à  buttonbg=colour&#x-5.1;à  buttonfg=colour&#x-5.1;à  buttonalpha=opacity&#x-5.1;ू3 stepnomousetype=fileext&#x-5.1;à  method=icon|widget|ocgposter[=first|num&#x-5.1;ू|last|none]alttext=none|{alternativedescription&#x-5.1;ू}Exceptfor`dvipdfmx',`xetex',`dvisvgm'and`export',thelistedpackageoptionsarealsoavailable(amongothers)ascommandoptionsandwillbeexplainedshortly.However,ifusedaspackageoptionstheyhaveglobalscope,takingeectonallanim-ationsinthedocument.Inturn,commandoptionslocallyoverrideglobalsettings.Op-tionswithoutanargumentarebooleanoptionsandcanbenegated,withtheexceptionofpackage-onlyoptions`dvipdfmx',`xetex',`dvisvgmand`export',byappending`=false'. Option`-Ppdf'shouldnotbeusedwithdvipswhenconvertingDVItoPostScript.Ifyoucannotdowithout,put`-D1200'after`-Ppdf'onthecommandline.UsersofLATEX-awaretexteditorswithmenu-driventoolchaininvocation,suchasTEXnicCenter,shouldcheckthecongurationofthedvipscall.Allworkowsrequirethe`graphicx'packagetobeloadedexplicitly.Options`dvipdfmx'or`dvisvgm'mustbesetforthedocumentclass,asin\documentclass[dvipdfmx,...]{...}or\documentclass[dvisvgm,...]{...}becausethesedriverscannotbeauto-detectedby`animate',`graphicx'andotherpack-ages.Usually,asecondLATEXrunisnecessarytoresolveinternallycreatedobjectreferences.Awarningmessagewillbeissuedifappropriate.Withoption`export',animationframesareoutputasindividualpagesofamultipagedocumentthatcanbeconvertedtootherleformats,suchasanimatedGIF.The`stan-dalone'documentclassmustbeusedtogetherwith`export':\documentclass{standalone}\usepackage[export]{animate}or\documentclass[export]{standalone}\usepackage{animate}5TheuserinterfacePackage`animate'providesthecommand\animategraphics[options.95;≀]{framerate&#x-5.1;ू}{filebasename&#x-5.1;ू}{first&#x-5.1;ᆇ}{last&#x-5.1;ڗ}andtheenvironment4 \begin{animateinline}[options.95;≀]{framerate&#x-5.1;ू}...typesetmaterial...\newframe[framerate&#x-5.1;ू]...typesetmaterial...\newframe*[framerate&#x-5.1;à  ]...typesetmaterial...\newframe\multiframe{numberofframes&#x-5.1;ू}{[variables&#x-5.1;ڗ]}{...repeated(parameterized)material...\multiframebreak%optional!}\newframe*[...]%some\newframevariantrequired\multiframe{...}{...}{%betweentwo\multiframes...}\end{animateinline}While\animategraphicscanbeusedtoassembleanimationsfromsetsofexistinggraphicslesorfrommultipagePDF,theenvironment`animateinline'ismeanttocreatetheanimationfromthetypesetmaterialitencloses.ThismaterialcanbepicturesdrawnwithintheLATEX`picture'environmentorusingtheadvancedcap-abilitiesofPSTricksorpgf/TikZ.Evenordinarytextualmaterialmaybeanimatedinthisway.Theparameterframerate&#x-5.1;ूspeciesthenumberofframespersecondoftheanimation.The\newframecommandterminatesaframeandstartsthenextone.Itcanbeusedonlyinsidethe`animateinline'environment.Thereisastarredvariant,\newframe*.Ifplacedafteraparticularframe,itcausestheanimationtopauseatthatframe.Theanimationcontinuesasnormalafterclickingitagain.Both\newframevariantstakeanoptionalargumentthatallowstheframeratetobechangedinthemiddleofananimation.The\multiframecommandallowstheconstructionofloopsaroundpictures.Therstargumentnumberofframes&#x-5.1;ूdoeswhatonewouldexpectittodo,thesecondargumentvariables&#x-5.1;ूisacomma-separatedlistofvariabledeclarations.Thelistmaybeofarbitrary,evenzero,length.Variablesmaybeusedtoparameterizepic-tureswhicharedenedintheloopbody(thirdargumentof\multiframe).Asinglevariabledeclarationhastheformvariablename&#x-5.1;ू=initialvalue&#x-5.1;ڗ+increment&#x-5.1;ूvariablename&#x-5.1;ूisasequenceofoneormoreletterswithoutaleadingbackslash 1 1 .Therst(andpossiblyonly)letterofthevariablenamedeterminesthetypeofthevariable.Therearethreedierenttypes:integers(`i',`I'),reals(`n',`N',`r',`R')anddi-mensionsorLATEXlengths(`d',`D').Uponrstexecutionoftheloopbody,thevariabletakesthevalueinitialvalue&#x-5.1;ू.Eachfurtheriterationincrementsthevariablebyincrement&#x-5.1;ू.Negativeincrementsmustbeprecededby`-'.Herearesomeexamples:`i=1+2',`Rx=10.0+-2.25',`dim=20pt+1ex'.Withintheloopbody,variablesareex-pandedtotheircurrentvaluebyprependingabackslashtothevariablename,that 1 Thisisdierentfrom\multido(package`multido')wherevariablenameshavealeading`\'inthedeclaration.5 is\i,\Rxand\dimaccordingtothepreviousexamples.\multiframemustbesur-roundedby\begin{animateinline}and\end{animateinline}orbyanyofthe\newframevariants.Twoconsecutive\multiframecommandsmustbeseparatedbyoneofthe\newframevariants.\multiframebreakcanbecalledtoterminatea\multiframeloopprematurely,usu-allyaspartofaconditionalstatement.Thiscommandshouldpreferablybeplacedneartheendoftheloopbodyinordernottoproduceanemptyanimationframe.Bydefault,theanimationisbuiltframebyframeintheorderofinclusionoftheembeddedmaterial.However,extendedcontroloftheorderofappearance,superpos-itionandrepetitionofthematerialisavailablethroughthe`timeline'option(seeSection 6.2 6.2 ).SetsofgraphicslesAlllesofthesequenceshouldexistandbeconsecutivelynumbered.(Exceptiontothisruleisallowedinconnectionwiththe`every'option,seebelow.)filebase-name&#x-5.1;ڗistheleftmostpartofthelenamethatiscommontoallmembersofthesequence.first&#x-5.1;ूisthenumberoftherstandlast&#x-5.1;ूthenumberofthelastleintheset.Iffirst&#x-5.1;ूisgreaterthanlast&#x-5.1;ू,lesareembeddedinreverseorder.Filenamesmaybesimplynumbered,suchas0§99.Ifthereareleadingzeros,makesurethatalllenumbershavethesamenumberofdigits,suchas0000§0099,andthatthefirst&#x-5.1;ूandlast&#x-5.1;ूargumentsarelledinaccordingly.Forexample,giventhesequence`frame_5.png'through`frame_50.png'fromapos-siblylargersetthatshallbeusedtobuildananimationrunningat12framespersecond,thecorrectinclusioncommandwouldread\animategraphics{12}{frame_}{5}{50}Thepossibleleformatsdependontheoutputdriverbeingused.InthecaseofLATEX+dvips,leswiththe`eps'extensionareatrstsearchedfor,followedby`mps'(META-POST-generatedPostScript)and`ps'.WithpdfLATEXandLuaLATEXthesearchingorderis:(1)`pdf',(2)`mps',(3)`png',(4)`jpg',(5)`jpeg',(6)`jp2'1,(7)`j2k'1,(10)`jpx'1,withXELATEXorLATEX+dvipdfmx:(1)`pdf',(2)`mps',(3)`eps',(4)`ps',(5)`png',(6)`jpg',(7)`jpeg',(8)`bmp',andwithLATEX+dvisvgm:(1)`pdf',(2)`eps',(3)`ps',(4)`mps',(5)`svg',(6)`png',(7)`jpg',(8)`jpeg'.Thatis,lescapableofstoringvectorgraphicsarefoundrst.Makesurethatalllenameshavelowercaseextensions.Thissearchingprocedurecanbeskippedthankstothepackageandcommandop-tion`type=fileext&#x-5.1;à  '.Itenforcestheembeddingofleswiththegivenlenameextensionfileext&#x-5.1;ू.Command\graphicspath{}fromthe`graphicx'packagecanbeusedtospecifydirectoriestobebrowsedforgraphicsles.MultipagePDFinclusionLuaLATEX,pdfLATEX,XELATEXandthedvipdfmxanddvisvgmbackendsareabletoem-bedanimationframesfrommultipagePDF.Ifthele`filebasename&#x-5.1;ू.pdf'exists,itistakenasamultipagedocumentwhereeachpagerepresentsoneframeoftheanimation.Inthiscase,thelasttwoarguments,first&#x-5.1;ू&last&#x-5.1;ू,areinterpreteddierentlyfromabove;theyspecifyazero-basedrangeofpagestobeincludedintheanimation.Eitherorbothofthemmaybeomitted,`{}',inwhichcasetheydefaultto 1OnlyLuaLATEXcurrentlysupportsJPEG2000.6 0andn*1,wherenisthetotalnumberofavailablepages.Argumentsthatfalloutsidethisrangeareautomaticallycorrectedtotheactuallimits.Iffirst&#x-5.1;ूisgreaterthanlast&#x-5.1;ू,pagesareembeddedinreverseorder.Again,option`type=fileext&#x-5.1;ू'canbeusedtoenforceaparticularleextension.Forexample,theline\animategraphics{12}{frames}{}{}wouldcreateananimationfromallpagesofthele`frames.pdf',runningat12fps.6CommandoptionsThefollowingoptionsto\animategraphicsand`animateinline'havebeenpro-vided.6.1Basicoptionslabel=labeltext&#x-5.1;ूTheanimationisgivenalabel,labeltext&#x-5.1;ू,whichmustbeunique.LabellingananimationenablesitsJavaScriptprogramminginterfacebydeninganim['labeltext&#x-5.1;ᆇ'],whichisaJavaScriptreferencetotheanimationobject.Theanimationob-jectprovidesanumberofpropertiesandmethodsthatcanbeusedforcontrollingtheanimationplaybackfromwithinuserdenedJavaScript.Fordetails,seeSection 7 7 .type=[fileext&#x-5.1;ू]Overridesthesearchingprocedureforgraphicslesexplainedintheprevioussectionandforcesleswithextensionfileext&#x-5.1;ूtobeused.Givenwithanemptyargu-mentasin`type=',thisoptionlocallyreinstatesthedefaultsearchingprocedureifitwasgloballydisabledthroughthepackageoption.poster[=first|num&#x-5.1;ू|last|none]Specieswhichframetodisplayandprintiftheanimationisnotactivated.Therstframeisshownbydefault.Thus,`poster'or`poster=first'neednotbeexplicitlyset.Aframenumbernum&#x-5.1;ूmayaswellbegiven;num&#x-5.1;ूiszero-based,thatis,therstframehasnumber`0'.every=num&#x-5.1;ूBuildanimationfromeverynum&#x-5.1;ूthframeonly.Skippedframesarediscardedandnotembeddedintothedocument.Inthecaseof\animategraphics,skippedinputlesmaybemissing.autopausePauseanimationwhenthepageisclosed,insteadofstoppingandrewindingittothedefaultframe.autoplayStartanimationafterthepagehasopened.Alsoresumesplaybackofapreviouslypausedanimation.autoresume7 Resumepreviouslypausedanimationwhenthepageisopenedagain.loopTheanimationrestartsimmediatelyafterreachingtheend.palindromeTheanimationcontinuouslyplaysforwardsandbackwards.stepStepthroughtheanimationoneframeatatimepermouse-click.Theframerate&#x-5.1;ڗargumentwillbeignored.width=h-size&#x-5.1;ूheight=v-size&#x-5.1;à  |totalheight=v-size&#x-5.1;ूkeepaspectratioResizetheanimationwidget.Ifonlyoneof`width'or`[total]height'isgiven,theotherdimensionoftheanimationwidgetisscaledtomaintaintheaspectratiooftherstframe'scontent.Ifboth`width'and`[total]height'aregiventogetherwith`keepaspectratio',therstframe'scontentisresizedtotwithinh-size&#x-5.1;ڗandv-size&#x-5.1;ूwhilemaintainingitsoriginalaspectratio.AnyvalidTEXdimensionisacceptedasaparameter.Inaddition,thelengthcommands\width,\height,\depthand\totalheightcanbeusedtorefertotheoriginaldimensionsoftherstframeoftheanimatedsequence.scale=factor&#x-5.1;ूScalestheanimationwidgetbyfactor&#x-5.1;ू.bb=llx&#x-5.1;à  lly&#x-5.1;ूurx&#x-5.1;ूury&#x-5.1;ू(\animategraphicsonly.)Thefour,spaceseparatedargumentssettheboundingboxofthegraphicsles.Unitscanbeomitted,inwhichcase`bp'(PostScriptpoints)isassumed.viewport=llx&#x-5.1;à  lly&#x-5.1;ूurx&#x-5.1;ूury&#x-5.1;ू(\animategraphicsonly.)Thisoptiontakesfourarguments,justlike`bb'.However,inthiscasethevaluesaretakenrelativetotheoriginspeciedbytheboundingboxinthegraphicsles.trim=left&#x-5.1;à  bottom&#x-5.1;ूright&#x-5.1;ूtop&#x-5.1;ू(\animategraphicsonly.)Cropsgraphicattheedges.Thefourlengthsspecifytheamounttoberemovedfromor,ifnegativevalueshavebeenprovided,tobeaddedtoeachsideofthegraphic.clip(\animategraphicsonly.)Clipsthegraphictothe(possiblymodied)boundingbox.pagebox=...hiresbbinterpolate(\animategraphicsonly.)Optionsfromthe`graphics'bundle.Refertothe`graphics'packagemanualfortheirmeaning.8 controls[=all|true|on]controls=(none|false|off)|{[play][,step][,stop][,speed]}Insertscontrolbuttonsbelowtheanimationwidget.Visibilityofbuttonscanbene-tunedthroughoptionalkeys.Bydefault,ifsetting`controls'alone,allavailablebut-tonsareshown,whileanyof`none',`false'or`off'suppressesthemaltogether.Acomma-separatedselectionfrom`play',`step',`stop'and`speed'enablescorres-pondingpairsorgroupsofbuttons.Suchacommalistmustbeenclosedinbraces,i.e.controls={...,...,...}.Ifallbuttonsareshown,theirmeaningisasfollows,fromlefttoright:stop&rstframe,stepbackwards,playbackwards,playforwards,stepforwards,stop&lastframe,decreasespeed,defaultspeed,increasespeed.Both`play'buttonsarereplacedbyalarge`pause'buttonwhiletheanimationisplaying.controlsaligned=left[+indent.95;≀]|center|right[+indent&#x-5.1;ू]Animationcontrolsarecentredbelowtheanimationwidgetbydefault.Withthisoptiononecanchoosebetweencentred,ush-leftorush-rightalignment.Theop-tionalindent&#x-5.1;ूinsertsadditionalhorizontalspacethatpushesthecontrolbuttonsawayfromtheleftorrightedgeoftheanimationwidgettowardstheoppositeside.indent&#x-5.1;ूmustbeavalidTEXdimension.Negativevaluesmaybeused,asincontrolsaligned=right+-4em,inwhichcasecontrolbuttonsprotrudebeyondtheanimation'srightverticaledgeby4em.buttonsize=size&#x-5.1;à  Changesthecontrolbuttonheighttosize&#x-5.1;ू,whichmustbeavalidTEXdimension.Thedefaultbuttonheightis1.44emandthusscaleswiththecurrentfontsize.buttonbg=colour&#x-5.1;à  buttonfg=colour&#x-5.1;à  buttonalpha=opacity&#x-5.1;ूBydefault,controlbuttonwidgetsaredrawnwithblackstrokesonempty,fullytrans-parentbackground.Thebackgroundcanbelledwithcolourusingtherstoption,whilethesecondoptionspeciesthestrokecolour.Optionbuttonalphaaddstrans-parencytothebackgroundcolour.Theparametercolour&#x-5.1;ूisanarrayofcolon-(:)-separatednumbersintherangefrom0.0to1.0.Thenumberofarrayelementsdeterminesthecolourmodelinwhichthecolourisdened:(1)grayvalue,(3)RGB,(4)CMYK.Forexample,`1',`1:0.5:0.2'and`0.5:0.3:0.7:0.1'arevalidcolourspecications.Theparameteropacity&#x-5.1;ूisanumberbetween0.0and1.0,where0.0producesfullytransparentand1.0fullyopaquebuttons.draftfinalWith`draft'theanimationisnotembedded.Instead,aboxwiththeexactdimen-sionsoftheanimationisinserted.Option`final'doestheoppositeasitforcestheanimationtobebuiltandembedded.Bothoptionscanbeusedtoreducecompilationtimeduringauthoringofadocument.Togetthemostoutofthemitisrecommendedtoset`draft'globallyasapackageorclassoptionandtoset`final'locallyasacom-mandoptionoftheanimationthatiscurrentlybeingworkedon.Afterthedocumenthasbeennished,theglobal`draft'optioncanberemovedtoembedallanimations.9 nomouseAnimationwidgetwillnotrespondtomouseclicks.UnlesstheJavaScriptinterface,Sect. 7 7 ,p. 15 15 ,isusedtocontroltheanimation,itisrecommendedtoalsosetatleastoneofthe`autoplay'or`controls'options.method=icon|widget|ocgThepackageimplementsthreedierentanimationmethods.The`icon'methodisthedefaultmethodandusuallygivesthebestperformanceintermsofanimationframerate.`widget'and`ocg'arealternativeanimationmethods.Inrarecases(standaloneanimationswithoutanimationcontrols)method`ocg'mayleadtoabetteranimationperformancethantheothertwo.Moreover,itallowsoverlayinganimationswithothertypesetmaterial,thatis,playinganimationsinthepagebackground.measureMeasurestheframerateduringonecycleoftheanimationandprintsthevaluetotheJavaScriptconsoleoftheReader.(Fortestingpurposes.)alttext=none|{alternativedescription&#x-5.1;ू} Changesorsuppressesalternativedescriptiontext.Thedefaultis`animationbyanimate[2020/10/07]'.ThistextisshownbysomePDFviewersthatarenotcapableofrenderingJavaScriptanimationsorusedforaccessibilitypurposes.begin={begintext&#x-5.1;à  }end={endtext&#x-5.1;à  } (`animateinline'only.)begintext&#x-5.1;ूandendtext&#x-5.1;ूareinsertedintothecodeatstartandendofeachframe.Mainlyusedforsettingupsomedrawingenvironment,suchasbegin={\begin{pspicture}(...,...)(...,...)},end={\end{pspicture}}Ashortnoteonthe`tikzpicture'environment:Unlike`pspicture',the`tikzpic-ture'environmentisabletodetermineitssizefromthegraphicalobjectsitencloses.However,thismayresultindierentlysizedframesofasequence,dependingonthesizeandpositionofthegraphicalobjects.Thus,inordertoensurethatallframesofthesequencebedisplayedatthesamescaleintheanimationwidget,acommonboundingboxshouldbesharedbytheframes.Aboundingboxcanbeprovidedbymeansofaninvisible`rectangle'object:begin={\begin{tikzpicture}\useasboundingbox(...,...)rectangle(...,...);},end={\end{tikzpicture}}6.2The`timeline'optiontimeline=timelinefile&#x-5.1;à  timelinefile&#x-5.1;ूisaplaintextlewhosecontentsdeterminestheorderofappear-anceoftheembeddedmaterialduringtheanimation.Itallowstheusertofreelyre-10 arrange,repeatandoverlaythematerialatanypointoftheanimation.ThismaygreatlyreducethelesizeoftheresultingPDF,asobjectsthatdonotchangebetweenseveralorallframes,suchascoordinateaxesorlabels,canbeembeddedonceandre-usedinotherframesoftheanimation.(Technically,thisisdonebytheXObjectreferencingmechanismofPDF.)Ifatimelineisassociatedwiththeanimation,thegraphicslesorinlinegraphicsem-beddedby\animategraphicsand`animateinline'nolongerrepresenttheactualframesoftheanimation.Rather,theyareacollectionoftransparenciesthatcanbeplayedwithatwill.However,itisnowuptotheauthor'sresponsibilitytoconstructatimelinethatmakesuseofeachofthosetransparenciesandtoputthemintoasens-ibleorder.Inordertoidentifythetransparencieswithinthetimelinele,theyarenumberedintheorderoftheirinclusion,startingatzero.Atimeline-basedanimationcanbethoughtofasalivingstackoftranslucenttrans-parencies.Eachanimationframeisasnapshotofthestackviewedfromabove.Trans-parenciesareusuallyputontopofthatstackandstaythereforagivennumberofframesbeforeexpiring(becominginvisible).Thelifetimeofeachtransparencywithinthestackcanbesetindividually.Onceexpired,atransparencycanbeputonthestackagain,ifdesired.Thestackmayalsobedividedintoanarbitrarynumberofsub-stackstofacilitatethecreationoflayers,suchasbackground,foregroundandintermediatelayers.Sub-stacksallowtheinsertionoftransparenciesatdepthpositionsoftheglobalstackotherthanjustthetop.Itisimportanttokeepthestack-likenatureofanima-tionsinmindbecausegraphicalobjectsontransparenciesathigherstackpositionsoverlaythecontentoftransparenciesatlowerstackpositions.GeneralstructureofthetimelineleEachlineofthetimelinelethatisnotblankandwhichdoesnotbeginwithacom-ment(`%')correspondstooneframeoftheanimation.Theremaybemoretransparen-ciesthananimationframesandvice-versa.Aframespecicationconsistsofthreeorfourcolon-(:)-separatedelds:[*]:[framerate&#x-5.1;à  ]:[transparencies&#x-5.1;ू][:JavaScript.94;䢐]Whileanyeldmaybeleftblank,thersttwocolonsaremandatory.Thefourtheld,JavaScript&#x-5.1;ू,isexplainedonp. 13 13 .Anasterisk(`*')intheleftmosteldcausestheanimationtopauseatthatframe,verymuchasa\newframe*woulddo;anumberinthesecondeldchangestheframerateoftheanimationsectionthatfollows.Inconnectionwiththe`timeline'option,theasteriskextensionandtheoptionalframerate&#x-5.1;ूargumentof\newframeceasetomakesenseandwillbetacitlyignoredifpresent.Thethirdeldtransparencies&#x-5.1;ूisacomma-separatedlistoftransparencyspecic-ationsthatdeterminesthetransparenciestobeputonthestack.Semicolons(;)areusedtoseparatesub-stacks(=layers)fromeachother.Asingletransparencyspecic-ationobeysthesyntaxtransparencyID&#x-5.1;ू[xnumberofframes&#x-5.1;ू]wheretransparencyID&#x-5.1;ूisanintegernumberthatidentiesthetransparencytobedrawnintothecurrentanimationframe.Aspointedoutabove,thetranspar-enciesareconsecutivelynumberedintheorderoftheirinclusion,startingatzero.Theoptionalpostx`xnumberofframes&#x-5.1;ू'speciesthenumberofconsecutive11 frameswithinwhichthetransparencyistoappear.Ifomitted,apostxof`x1'isassumed,whichcausesthetransparencytobeshowninthecurrentframeonly.Obvi-ously,numberofframes&#x-5.1;ूmustbeanon-negativeintegernumber.Themeaningofpostx`x0'isspecial;itcausesthetransparencytobeshowninallframes,startingwiththecurrentone,untiltheendoftheanimationoruntiltheanimationsub-stacktowhichitbelongsisexplicitlycleared.Theletter`c',ifputintotransparencies&#x-5.1;ू,clearsananimationsub-stack,thatis,itcausesalltransparenciesaddedsofartoberemovedfromthesub-stack,overridinganynumberofframes&#x-5.1;ूvalue.Theeectof`c'isrestrictedtothesub-stackinwhichitappears.Thus,a`c'mustbeappliedtoeverysub-stackifthecompleteanim-ationstackistobecleared.Moreover,ifapplied,`c'shouldgointotherstpositionofthetransparencylistofasub-stackbecauseeverythinginthesub-stackupto`c'willbecleared.TimelineexamplewithasingleanimationstackTable 1 1 isanexampleofasingle-stackanimation.Itliststhecontentsofatimelineletogetherwiththeresultingstackoftransparencies.Notehowthestackisstrictlybuiltfromthebottomupastransparencyspecicationsarereadfromlefttorightandlinebylinefromthetimelinele.InframeNo.4,thestackisrstclearedbeforenewtransparenciesaredepositedonit.Alsonotethatthestackisviewedfromaboveandtransparenciesinhigherstackpositionoverprintthelowerones. Table1:Timelineexampleofasingle-stackanimation frameNo. timelinele transparencystack 0 ::0x0,1x2 1 0 1 ::2 2 1 0 2 ::3 3 0 3 ::4 4 0 4 ::c,5x0,6 6 5 5 ::7 7 5 6 ::8 8 5 7 ::9 9 5 Figures 1 1 and 4 4 inSect. 8.1 8.1 areanimationexampleswithasingletransparencystack.Groupingobjectsintolayers(=sub-stacks)using`;'Duetothestack-likenatureoftheanimation,thepositionofatransparencyspecic-ationinthetimelineledeterminesitsdepthlevelinrelationtoothertransparencies.Thetimelineleisprocessedlinebylineandfromlefttoright.Inasingle-stackan-12 imation,thestackisstrictlybuiltfromthebottomup,suchthatearliertransparenciesareoverprintedbymorerecentones.Thismayturnouttobeinconvenientincertainsituations.Forexample,itmightbedesirabletochangethebackgroundimageinthemiddleofananimationwithoutaectingobjectsthatarelocatedintheforeground.Forthispurpose,transparencyspecicationscanbegroupedintolayers(sub-stacks)usingthesemicolon(;)asaseparator.Newtransparenciescannowbeputontopoftheindividualsub-stacks.Afteralineofthetimelinelehasbeenprocessed,theglobalstackisbuiltbyplacingthesub-stacksontopoftheother.Again,theleft-to-rightruleapplieswhendeterminingtheheightofthesub-stacksinrelationtoeachotherwithintheglobalstack.Thelayerconceptisbestillustratedbyanexample.InthetimelineofTable 2 2 ,trans-parenciesaregroupedintotwosub-stacksonly.Oneisreservedforthebackgroundimages,transparenciesNo.0&1,tobeexchangedinframeNo.3,aswellasfortwoothertransparencies,No.7&8,tobeinterspersedinframeNo.1.Asecondsub-stacktakestheforegroundobjectsthataresuccessivelyaddedtothescene.Thedottedlinesinthethirdcolumnofthetablejustmarktheborderbetweenthetwosub-stacks.InframeNo.3,`c'rstclearsthebottomsub-stackbeforethenewbackgroundim-ageisinserted.(Instead,`x3'couldhavebeenusedwithtransparencyNo.0inframeNo.0.)AscanbeseeninthespecicationsofframesNo.2&4,sub-stacksneednotbeexplicitlypopulated;theleadingsemicolonsjustensuretheproperassignmentoftransparenciestoanimationsub-stacks.Seethesecondanimation,Fig. 2 2 ,inSect. 8.1 8.1 foraworkingexamplethatmakesuseofthetimelineandthelayerconcept.AssociateJavaScriptactionswithanimationframesTheoptionalfourtheldJavaScript&#x-5.1;ूinaframespecicationtakesJavaScriptcodetobeexecutedupondisplayofthatframe.Thiscouldbeused,forinstance,toplayasoundthatwasembeddedusingthe`media9'LATEXpackage[ 7 7 ]ortoexecuteJava-Scriptmethodsoftheanimationobject.Anon-trivialexampleisloopingoverasub-rangeofframeswhichcanbeprogrammedbysettingthe`frameNum'propertyoftheanimationobject.SeeSection 7 7 fordetailsoftheanimationprogramminginterface.Thebackslash`\'andpercent`%'charactersretaintheirspecialmeaningfromLATEXandmustbeescapedbyabackslash`\'intheJavaScriptcode.Thesameappliestounbalancedbraces`{'and`}'.Thus,acodelinesuchasconsole.println('{}%}{\n');wouldhavetolooklikeconsole.println('{}\%\}\{\\n');inthetimelinele.Therstpairofbracesarebalancingthemselvesanddonotneedtobeescaped.NotethatJavaScriptisexecutedatthestartofdisplayingtheframe.Ifsomethingistobeexecutedattheendofaparticularframe,theJavaScript&#x-5.1;ूeldshouldbeaddedtothenextframeinthetimelinele.However,thisisnotpossibleforthelastframeinatimelinele.Here,the`setTimeOut'methodcanbeusedtodelaytheexecutionofcommands:app.setTimeOut('anim.myanim.frameNum=5;',0.5*anim.myanim.dt)13 Table2:Timelineexamplewithtwosub-stacks frameNo. timelinele transparencystack 0 ::0x0;2x0 2 ................................... 0 1 ::7,8x2;3x0 3 2 ................................... 8 7 0 2 ::;4x0 4 3 2 ................................... 8 0 3 ::c,1x0;5x0 5 4 3 2 ................................... 1 4 ::;6x0 6 5 4 3 2 ................................... 1 Inthisexample,the6thframewillbedisplayedafterhalfofthecurrentframe'slife-timehaselapsed.OtherthingstonoteWhendesigningthetimeline,careshouldbetakennottoincludeatransparencymorethanonceintothesameanimationframe.Besidestheuselessredundancy,thismayslowdowntheanimationspeedintheReaderbecausethegraphicalobjectsofamul-tiplyincludedtransparencyhavetoberenderedunnecessarilyoftenatthesametime.`animate'issmartenoughtodetectmultipleinclusionandissuesawarningmessagealongwiththetransparencyIDandtheframenumberifitoccurs.Hereisanexampleofapoorlydesignedtimeline:::0::1x0::2::3::4,214 ::5,1 %bad:transparency`1'includedtwice ::6Also,`animate'ndsandwarnsabouttransparenciesthathaveneverbeenusedinananimationtimeline.ThismayhelptoavoiddeadcodeinthenalPDF.7ProgramminginterfaceThepackageprovidesasimpleJavaScriptprogramminginterfacewhichgivesaccesstotheanimationobjectsinaPDFle.Aparticularanimationpropertyormethodcanbeaccessedbyanim['animlabel&#x-5.1;ू'].propertyormethod&#x-5.1;ूoranim.animlabel&#x-5.1;à  .propertyormethod&#x-5.1;ू`anim'isanarrayofanimationobjectreferences.Animationsmustbelabelledusingthe`label=...'commandoptioninordertobepresentinthe`anim'array.Asusual,propertiesandmethodsareaccessedviathedotnotation.PropertiesandmethodsoftheanimationobjectaresummarizedinTables 3 3 and 4 4 .OnepotentialuseoftheJavaScriptinterfacecouldbewithinatimelineleassociatedwithananimation.Forexample,loopsoverasub-rangeofframescanbeprogrammedbysettingthe`frameNum'property.SeeSection 6.2 6.2 ,p. 13 13 fordetails.Also,theprogramminginterfacecanbeusedtocreatecustombuttonsforplaybackcontrol.Thecommand\mediabuttonfromthe`media9'packageprovidesaconveni-entwayforachievingthis:\usepackage{media9}\usepackage{animate}...\animategraphics[label=my_anim]{12}{...}{...}{...}\mediabutton[jsaction={anim['my_anim'].playFwd();}]{\fbox{Play}}\mediabutton[jsaction={anim['my_anim'].frameNum=5;}]{\fbox{Goto6thframe}}15 Table3:Animationobjectproperties nametypeaccessdescription numFramesIntegerread-onlyHoldsthetotalnumberofanimationframes.frameNumIntegerread+writeGetsorsetsthecurrentframebeing/tobedisplayed.Notethatframenumbersarezero-based.AssigningavaluelessthanzeroorgreaterthannumFrames-1resultsinanerror.fpsNumberread+writeGetsortemporarilysetstheanimationframerate(framespersecond).Resetafterreachingtheendofasequence,oriftheframerateissetinatimelineorby\newframe[framerate&#x-5.1;ڗ].Forscalingoverallanimationspeed,considerusingthespeedproperty.Assigningavaluelessthanzeroresultsinanerror.speedNumberread+writeGloballyscalesanimationspeed.Thevaluemustbegreaterthanzero.Avalueof1means`normalspeed'asspeciedbytheframerateinthedocumentsource.Largervaluesmean`faster',valuesbetweenzeroandonemean`slower'.dtNumberread-onlyHoldsthetimespan(milliseconds)fordis-playofthecurrentframe.isPlayingBooleanread-onlyHoldsthevaluetrueiftheanimationiscurrentlyplaying,falseotherwise.playsFwdBooleanread-onlyHoldsthevaluetrueiftheanimationisplayedforward,independentlyofwhethertheanimationiscurrentlypausedornot. Table4:Animationobjectmethods namedescription playFwd()Startsplayingtheanimationintheforwarddirection,settingthepropertiesisPlayingandplaysFwdtotrue.playBwd()Startsplayingtheanimationinthebackwarddirection,settingisPlayingtotrueandplaysFwdtofalse.pause()Pausesanimation,settingisPlayingtofalse.stopFirst()Stopsanimationandrewindstotherstframe.isPlayingissettofalse.stopLast()Stopsanimationandgoestothelastframe.isPlayingissettofalse. 16 8Examples8.1Animationsfromsetsofles,using\animategraphicsAnimationsinthissectionaremadefromgraphicslesthatwerepreparedwithMETAPOST.Run`mpost--tex=latex'onthelesendingin`.mp'inthe`les'directorytogeneratethegraphicsles.Bothexamplesmakeuseofthe`timeline'optiontoreducetheresultingPDFlesize.Therstexample,Fig. 1 1 ,originallywrittenbyJanHole£ek[ 4 4 ],showstheexponentialfunctiony=exanditsapproximationbyTaylorpolynomialsofdierentdegree.Belowtheanimation,acustombuttonwasinsertedusingtheJavaScriptprogramminginterfaceandthe\mediabuttoncommandfromthe`media9'package.\documentclass{article}\usepackage{animate}\usepackage{media9}\usepackage{graphicx}\begin{filecontents}{timeline.txt}::0x0 %coordinatesystem&y=e^x,repeateduntillastframe ::1 %onebluecurveperframe ::2::3::4::5::6::7::8\end{filecontents}\begin{document}\begin{center}\animategraphics[label=taylor,controls,loop,timeline=timeline.txt]{4}{exp_}{0}{8}\mediabutton[jsaction={if(anim['taylor'].isPlaying)anim['taylor'].pause();elseanim['taylor'].playFwd();}]{\fbox{Play/Pause}}\end{center}\end{document}17 Figure1Thesecond,somewhatmorecomplexexample,Fig. 2 2 ,animatesthegeometriccon-structionofascarabaeus.Inadditiontotheuseofatimeline,itintroducesthelayerconcept.ThisexampleisadaptedfromMaximeChupin'soriginalMETAPOSTsourcele[ 1 1 ].Thepresentversionseparatesstationaryfrommovingpartsofthedraw-ingandsavesthemintodierentles.Atotalof254les,scarab_0.mpsthroughscarab_253.mps,iswrittenoutbyrunning`mpost--tex=latex'onthesourcele`scarab.mp'.Files0through100containtheredlinesegmentsthatmakeupthegrow-ingscarabaeus.Files101through201containthemovingconstructionlinesandles202through252containthegraylineswhichrepresentintermediatestagesoftheconstruction.Thelastle,No.253,containsthecoordinateaxes,twostationarycon-structionlinesandthelabelswhichdonotmove.Atimelinele`scarab.tln'iswrittenouton-the-yduringtheLATEXrun.Itarrangestheanimationintothreelayers,forcingthegraylinesintothebackground,thecoordinateaxesintotheintermediatelayerandthescarabaeusalongwiththemovingconstructionlinesintotheforeground.The-nalanimationconsistsof101individualframes.\documentclass{article}\usepackage{intcalc} %defines\intcalcModforModulocomputation \usepackage{animate}\usepackage{graphicx}\newcounter{scarab}\setcounter{scarab}{0}\newcounter{blueline}\setcounter{blueline}{101}\newcounter{grayline}\setcounter{grayline}{202} %writetimelinefile 18 Figure2\newwrite\TimeLineFile\immediate\openout\TimeLineFile=scarab.tln\whiledo{\thescarab101}{\ifthenelse{\intcalcMod{\thescarab}{2}=0}{ %agraylineisaddedtoevery2ndframe \immediate\write\TimeLineFile{ % ::\thegraylinex0;253;\thescarabx0,\theblueline}\stepcounter{grayline}}{\immediate\write\TimeLineFile{ % ::;253;\thescarabx0,\theblueline}}\stepcounter{scarab}\stepcounter{blueline}}\immediate\closeout\TimeLineFile\begin{document}\begin{center}\animategraphics[width=0.8\linewidth,controls,loop,19 timeline=scarab.tln]{12}{scarab_}{0}{253}\end{center}\end{document}8.2AnimatingPSTricksgraphics,using`animateinline'envir-onmentFig. 3 3 isaninlinegraphicsexampleadaptedfrom[ 3 3 ].\documentclass{article}\usepackage{pst-3dplot}\usepackage{animate} %drawsatorussector \newcommand{\torus}[2]{ %#1:angleofthetorussector,%#2:linewidthofleadingcircle \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} % \parametricplotThreeD[yPlotpoints=1,linewidth=#2](0,360)(#1,#1){ % ucos2mul4tsin2muladdmulusin2mul4tsin2muladdmultcos4mul} % \end{pspicture} % }\begin{document}\begin{center}\begin{animateinline}[poster=last,controls,palindrome]{12} % \multiframe{29}{iAngle=80+10,dLineWidth=2.9pt+-0.1pt}{ %%iAngle=80,90,...,360degrees%dLineWidth=2.9pt,2.8pt,...,0.1pt \torus{\iAngle}{\dLineWidth} % } % \end{animateinline} % \end{center}20 Figure3\end{document}Anotherinlineexample,Fig. 4 4 ,isananimationoftheLorenzAttractor.TheLorenzAttractorisathree-dimensionalparametriccurvewhosecoordinatesareobtainedbyintegratingthesetofthreeordinarydierentialequationsdx dt= .y*x/dy dt=x. *z/*ydz dt=xy*\rzwithrespecttotheindependentparametert.Theshapeoftheattractorstronglyde-pendsonthevalueschosenforthecoecients , and\raswellasontheinitialconditions,thatis,thecoordinatesx0,y0andz0ofthestartingpointofthecurve.Hereweusethevalues =10, =28,\r=8_3andthestartingpointx0=.10;10;30/.Therighthandsidesoftheequationsabovearedenedinthemacro\lorenzasalgeb-raicexpressions.Theinitialvalueproblemissolvedbythemacro\pstODEsolvefromthePSTrickspackage`pst-ode'andplottedbythemacro\parametricplotThreeDfromthePSTrickspackage`pst-3dplot'.Atimelinele,writtenon-the-y,isusedtoassemblethecurvesegmentsframebyframetothegrowingattractorwhich,inturn,isputontopofthex-y-zcoordinatesys-tem.Aftertheattractorhasbeencompleted,thetransparencystackiscleared.Then,transparenciescontainingthecompletecurveandthecoordinatesystemseenfromdierentviewpointsareputinarowtoproducetheanimatedy-around.\documentclass{article}\usepackage{multido}\usepackage{pst-3dplot}\usepackage{pst-ode}\usepackage{animate}\begin{document}21 Figure4 %Lorenz'setofdifferentialequations \def\lorenz{ % 10*(x[1]-x[0])| %dx/dt x[0]*(28-x[2])-x[1]| %dy/dt x[0]*x[1]-8/3*x[2] %dz/dt } %%%writetimelinefile \newwrite\OutFile % \immediate\openout\OutFile=lorenz.tln % \multido{\iLorenz=0+1}{101}{ % \immediate\write\OutFile{::\iLorenzx0} % } % \immediate\write\OutFile{::c,101} % \multido{\iLorenz=102+1}{89}{ % \immediate\write\OutFile{::\iLorenz} % } % 22 \immediate\closeout\OutFile %% \psset{unit=0.155,linewidth=0.5pt} % \noindent\begin{animateinline}[timeline=lorenz.tln,controls,poster=last,begin={\begin{pspicture}(-36,-13)(36,55)},end={\end{pspicture}}]{10} %coordinateaxes \psset{Alpha=120,Beta=20} % \pstThreeDCoor[xMax=33,yMax=33,zMax=55,linecolor=black] % \newframe %attractorsegments \gdef\initCond{101030} %initialcondition \pstVerb{/lorenzXYZall{}def} %takesthewholeattractor \multiframe{100}{rtZero=0+0.25,rtOne=0.25+0.25}{ %%computecurrentattractorsegment,storeitin`lorenzXYZseg' \pstODEsolve[algebraic]{ % lorenzXYZseg}{012}{\rtZero}{\rtOne}{26}{\initCond}{\lorenz} %%emptyinitialcondition--�next\pstODEsolvecontinues \gdef\initCond{} %fromlaststatevector%appendsegmenttothewholeattractorstoredin`lorenzXYZall' \pstVerb{ % /lorenzXYZall[lorenzXYZalllorenzXYZseg]aloadastorecvxdef} %%plotthecurrentsegment \listplotThreeD[plotstyle=line]{lorenzXYZseg} % } % \newframe %requiredbetweentwo\multiframe%fly-around(wholeattractor) \multiframe{90}{rAlpha=116+-4}{ % \psset{Alpha=\rAlpha,Beta=20} % \pstThreeDCoor[xMax=33,yMax=33,zMax=55,linecolor=black] % \listplotThreeD[plotstyle=line]{lorenzXYZall} % } % \end{animateinline}\end{document}ThelastinlineexampleinFig. 5 5 isatickingmetronomewrittenbyManuelLuque[ 5 5 ].Theshortclickingsoundwasembeddedbymeansofthe`media9'package.Wheneverthependulumreachesoneofitsreversalpoints,playbackofthesoundleisstartedusingJavaScript.TheJavaScriptcodewasinsertedatthecorrespondingframespe-cicationsinatimelinele.SincethePSTricksmacrosfordrawingthemetronomebodyandthependulumarequitelongtheyhavebeenmovedintoanexternalle,files/pstmetronome.tex.NotethatthesoundcanbeheardonlyonWinandMacplatforms.Eventhen,mileagemayvary.AdualcoreCPUmaybenecessaryforuentplayback.\documentclass[12pt]{article}23 \usepackage{pstricks,pst-node,pst-plot,pst-tools,pst-text}\usepackage{animate}\usepackage{media9} %writingtimelinetoexternalfile \begin{filecontents}{metro.txt}::0x0,1:annotRM['click'].callAS('play');::2::3::4::5::6::7::8::9::10::11::12::13::14::15::16 Figure524 ::17::18::19::20::21::22::23::24::25::26:annotRM['click'].callAS('play');\end{filecontents}\begin{document}\begin{center} %loadingmetronomemacrosfromexternalfile \input{files/pstmetronome} %%soundinclusion:click.mp3 \makebox[0pt][r]{\includemedia[width=1ex,height=1ex,label=click,addresource=click.mp3,activate=pageopen,transparent,noplaybutton,flashvars={source=click.mp3&hideBar=true}]{}{APlayer.swf}} %%%animatedmetronome \begin{animateinline}[controls,width=0.7\linewidth,palindrome,begin={\begin{pspicture}(-9.5,-5)(9.5,15)},end={\end{pspicture}},timeline=metro.txt]{25} %metronomewithoutpendulum \metronomebody\newframe %halfperiodofpendulumswing(26frames) \multiframe{26}{i=0+4}{\pendulum{\i}}\end{animateinline}\end{center}\end{document}25 9AnimatedSVGThankstoMartinGieseking'sdvisvgmutility[ 2 2 ]thatshipswithallmajorTEXdis-tributions,package`animate'canproduceself-containedanimatedSVG,withallthebitsandpiecesalreadyincludedthatarenecessarytoruninmodernWebbrowsersasstandalonelesorasembeddedobjectswithinaWebpagemadeofHTML.Anim-ationshavethesamelookandusability,includingoptionalcontrolbuttons,asiftheywereembeddedinaPDFdocument.AnimatedSVGevenworkonmobiledevices.AsdvisvgmislinkedagainsttheGhostscriptlibrary,itcanparseandconvertembed-dedPostScripttoinlineSVGcode.ItisthereforecompatiblewiththepopularTikZandPSTricksLATEXpackages.SVGisasingle-pagegraphicsformat.Therefore,itisrecommendedtoproducedoc-umentswithasingleanimationperleorpage.Thereafter,dvisvgmconvertseverypageoftheDVIinputtoastandaloneanimatedSVGle.Youmaywanttousethe`standalone'documentclassforcreatingstandaloneSVGanimations.Pass`dvisvgm'asaglobaldocumentclassoption.Inthisway,itgetsconveyedto`animate'andotherpackagestobeloaded,suchas`graphicx'orTikZ.ThefollowingcodemayserveasatemplateforgeneratingstandaloneanimatedSVG:\documentclass[dvisvgm]{standalone} %\usepackage{xcolor}%\pagecolor{white}%opaquebackgroundwithsolidcolour%\usepackage{pstricks}%enableasneeded%\usepackage{tikz} \usepackage{animate}\usepackage{graphicx}\begin{document} %%\animategraphics{..}{...}{...}{...}%%or%%\begin{animateinline}{..}...\end{animateinline}% \end{document}Notethatwhenanimatingexternalgraphicswith\animategraphics,onlyPDFandPostScript(EPS,PS,MPS)lesareconvertedtoinlineSVGcode;lesinotherformats(SVG,PNG,JPEG)remainexternalandmustbebundledwiththenalSVGoutput.Thus,forobtainingself-containedSVG,itisrecommendedtoconvertPNG,JPEGandSVGlestoPDForPostScriptrst.AlsonotethatPostScriptlesmusthaveallre-quiredfontsembedded.ThisisnotalwaysthecaseforMETAPOST-generatedPost-Script.Here,embeddingoffontsisensuredbyputting`prologues:=3;'intotheheaderoftheMETAPOSTinput.26 Useoneoflatexplatexdvilualatexxelatex-no-pdftoproduceDVIorXDVoutputfromtheLATEXsource.Afterthis,SVGisobtainedbyrunningdvisvgm--font-format=woff--exact--zoom=-1--page=1,-...ontheintermediateDVIorXDVle.Option`--font-format=woff'(or`--font-format=woff2')promptsdvisvgmtoembeddocumentfontsinaformatthatisunderstoodbyWebbrowsers.ItensuresthattypesettextlooksasinnormalPDFoutput.Option`--exact'tellsdvisvgmtocalculateexactboundingboxesaroundfontglyphs.ThisavoidsclippingofglyphsintheSVGoutput,asglyphsusuallytendtobeslightlybiggerthantheirboxesdenedinthefontles.Thepurposeof`--zoom=-1'istoproduceresponsiveSVG.IfembeddedinaWebpage,thiskindofSVGwillautomaticallyscaletolluptheavailablespaceofitssurroundingcontainer,usuallyanobject&#x-5.1;ूtag(seebelow).IfviewedstandaloneinaWebbrowser,aresponsiveSVGllsupthecompletebrowsertab.Bydefault,dvisvgmprocessesonlytheveryrstpageoftheinputle.ToconvertmultipageDVI/XDVwithseveralanimations,addoption`--page=1,-'.AsSVGderivesfromXMLitisnotknowntobeparticularlyeconomicalintermsoflesize.CompressedSVG,withleextension`svgz',shortensdownloadtimesandissupportedbymostWebbrowsers.Itcanbegeneratedbyaddingoption`-z'.Also,option`--precision=1'maybeusedtoreducetheSVGlesize.Itlimitsthepreci-sionofoatingpointnumbers,suchascoordinates,toonedecimalgure.Sometimes,animationsmaybehavestangelyafterapplyingthisoption.Then,ofcourse,itshouldbeomitted.TherecommendedwaytoincludeanimatedSVGintoHTMListousetheobject&#x-5.1;ڗtag.Theimg&#x-5.1;ूtagdoesnotworkhere,asitignorestheembeddedJavaScript.How-ever,itmaystillbeusedasfallback.Also,itallowsforsearchengineindexing,ifdesired:objecttype="image/svg+xml"data="animatedImage.svg"&#x-5.1;ू!--optional(increasesloadingtime):fallback&searchengineindexing--&#x-5.1;ूimgsrc="animatedImage.svg"/&#x-5.1;ू/object&#x-5.1;ूInTEX4htdocuments,thewholeobject&#x-5.1;ू.../object&#x-5.1;ूtagcanbeinsertedbywrappingitina\HCode{...}command.27 10BugsˆThemaximumframeratethatcanactuallybeachievedlargelydependsonthecomplexityofthegraphicsandontheavailablehardware.InAcrobatReader,youmightwanttoexperimentwiththe2Dgraphicalhardwareaccelerationfea-ture.Gotomenu`Edit'E`Preferences'E`PageDisplay'E`Rendering'toseewhetherhardwareaccelerationisavailable.A2DGPUaccelerationcheckboxwillbevisibleifasupportedvideocardhasbeendetected.Also,enablingordis-ablingthepagecache(`Edit'E`Preferences'E`PageDisplay'E`Rendering'E`Usepagecache')mayaecttherenderingperformance.ˆAnimatedSVGisbestviewedinWebbrowsersthatarebasedontheBlinkren-deringengine.ThemostprominentrepresentativesareChrome,itsopen-sourcebaseChromiumandOpera.Unfortunately,Firefoxisveryslow.ˆThedvipsoption`-Ppdf'shouldbeavoidedentirelyorfollowedbysomethinglike`-D1200'onthecommandlineinordertosetasensibleDVIresolution.Thisdoesnotdegradetheoutputquality!Thecongurationle`cong.pdf'loadedbyoption`-Ppdf'speciesanexcessivelyhighDVIresolutionthatwillbepassedontothenalPDF.Eventually,AcrobatReadergetsconfusedandwillnotdisplaytheframeswithintheanimationwidget.ˆAnimationsdonotworkifthePDFwasproducedwithGhostscriptversionsolderthan9.15.ˆIfthe`animateinline'environmentisusedinaright-to-lefttypesettingcon-text(RTL)andusingthe(pdf)LATEXandXELATEXengines,everyframe'scontentshouldbeenclosedinapairof\beginRand\endRcommandsinordertocor-rectlytypesetRTLtextcontainedtherein.Thiscanbeconvenientlydonebymeansofthe`begin'and`end' options options ofthe`animateinline'environment.ˆ Animationswithcomplexgraphicsand/ormanyframesmaycauseLATEXtofailwitha`TeXcapacityexceeded'error.Thefollowingstepsshouldxmostofthememoryrelatedproblems.MiKTEX:1.OpenaDOScommandpromptwindow(execute`cmd.exe'via`Start'E`Run').2.AttheDOSprompt,enterinitexmf--edit-config-file=latex3.Typemain_memory=12000000intotheeditorwindowthatopens,savetheleandquittheeditor.4.Torebuildtheformat,enterinitexmf--dump=latex5.Repeatsteps 2 2  4 4 withconglespdflatexandxelatexTEXLive:28 1.Findthecongurationle`texmf.cnf'bymeansofkpsewhichtexmf.cnfattheshellpromptinaterminal.2.AsRoot,opentheleinyourfavouritetexteditor,scrolltothe`main_memory'entryandchangeittothevaluegivenabove;saveandquit.3.Rebuildtheformatsbyfmtutil-sys--byfmtlatexfmtutil-sys--byfmtpdflatexfmtutil-sys--byfmtxelatexˆPDFswithanimationscannotbeembedded(via\includegraphics,\includepdf)intootherdocumentsastheanimationcapabilitygetslost.ˆAnimationsshouldnotbeplacedonmultilayeredslides,alsoknownasoverlays,createdwithpresentationmakingclassessuchasBeamerorPowerdot.ThosedocumentclassesturnoverlaysintoseparatePDFpagesandre-insertthean-imationoneverypagethusproduced.Theanimationsareindependentfromeachotheranddonotsharethecurrentplayingstate,suchasframenumber,playingspeedanddirection.Therefore,putanimationsonatslidesonly;slideswithoutanimationsmaystillhaveoverlays,ofcourse.On TEX.SE TEX.SE [ 8 8 ],amethodissuggestedforplacingananimationonaslidewithoverlays.ItmakesuseoftheprogramminginterfaceintroducedinSect. 7 7 ,p. 15 15 .11AcknowledgementsIwouldliketothankFrançoisLafontwhodiscoveredquiteafewbugsandmademanysuggestionsthathelpedtoimprovethefunctionalityofthepackage.ManythankstoJin-HwanCho,thedeveloperofdvipdfmx,forcontributingthedvipdfmxspeciccode,andtoWalterScottforproof-readingthedocumentation.References[1]Chupin,M.:SyracuseMetaPost/Animations.URL: http://melusine.eu.org/ http://melusine.eu.org/ http://melusine.eu.org/ http://melusine.eu.org/ syracuse/metapost/animations/chupin/?idsec=scara syracuse/metapost/animations/chupin/?idsec=scara syracuse/metapost/animations/chupin/?idsec=scara syracuse/metapost/animations/chupin/?idsec=scara [2]dvisvgm:AfastDVItoSVGconverterURL: http://dvisvgm.de http://dvisvgm.de [3]Gilg,J.:PDF-Animationen.In:DieTEXnischeKomödie,Issue4,2005,pp.3037[4]Hole£ek,J.;Sojka,P.:AnimationsinpdfTEX-generatedPDF.In:TEX,XML,andDi-gitalTypography,Springer,2004,pp.179191.doi:10.1007/978-3-540-27773-6_14[5]Luque,M.:PSTricks:applications.URL: http://pstricks.blogspot.com http://pstricks.blogspot.com [6]Themedia4svgPackage.URL: http://www.ctan.org/pkg/media4svg http://www.ctan.org/pkg/media4svg [7]Themedia9Package.URL: http://www.ctan.org/pkg/media9 http://www.ctan.org/pkg/media9 [8]Beamer:animatepackageandoverlay.URL: https://tex.stackexchange.com https://tex.stackexchange.com https://tex.stackexchange.com https://tex.stackexchange.com /a/385209 /a/385209 /a/385209 /a/385209 29