FigAnim

FigAnim is a XFig file animator class.
Download

FigAnim Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • K. Imakita,Q. Lamerand and F. Perrin
  • Publisher web site:
  • http://search.cpan.org/~figanim/FigAnim-0.1/FigAnim.pm

FigAnim Tags


FigAnim Description

FigAnim is a XFig file animator class. FigAnim is a XFig file animator class.SYNOPSISHere is a simple example where we first parse a file "file.fig". This file is supposed to contain an object named "Square" (in XFig the name of an object is it's commentary). Then this object translates according to vector (50px, 25px), the animation starts at t=0 second and it's duration is 1 second. In the end we generate an animated GIF file named "anim.gif", and a SVG+SMIL file named "anim.svg". use FigAnim; $fig_anim = new FigAnim; $fig_anim->parseFile("file.fig"); $fig_anim->{objects}->{Square}->translate(0, 1, 50, 25, 'px'); $fig_anim->generateGif("anim.gif", 12, 0); $fig_anim->generateSMIL("anim.svg");ABSTRACTFigAnim is a package which takes an existing FIG file (made by the XFig vector drawing program for example) and generates animations in animated GIF format and/or in SVG+SMIL format.Here are all the methods you can use in the package FigAnim :new(), parseFile(), writeFile(), setAttributevalue(), setPenColor(), setFillColor(), hide(), show(), changeThickness(), changeFillIntensity(), scale(), translate(), rotate(), generateGIF(), writeSVGfile(), generateSMIL(), selectByType(), selectByPenColor(), selectByFillColor(), selectByAttributeValue()The time unit used for every animation is in seconds.BASIC COMMANDSnew()Creates a new instance of the class FigAnim. Every animation must begin with these two lines: use FigAnim; $fig_anim = new FigAnim;parseFile()Parses the file given in parameter, for example: $fig_anim->parseFile("file.fig");where "file.fig" is a correct FIG file.writeFile()Writes a new FIG file from another parsed FIG file. This method is only used for testing purpose (to test the identity). Example: $fig_anim->writeFile("another_file.fig");SETsetAttributeValue()This method sets an attribute value of an object at a given time, without any interpolation. For example, if we have in our FIG file an object named "Square": $fig_anim->{objects}->{Square}->setAttributeValue(3, 'thickness', 2);sets the attribute "thickness" of object "Square" to 2 at instant t=3 seconds.setPenColor()Example: $fig_anim->{objects}->{Square}->setPenColor(4, 'Green4');this command modifies the object's pen color to a color called Green4 (in XFig) at instant t=4s, without any interpolation.setFillColor()Example: $fig_anim->{objects}->{Square}->setFillColor(5, 'Green4');similar to previous method, but modifies fill color instead of pen color at t=5s.HIDE/SHOWhide()Example: $fig_anim->{objects}->{Square}->hide(3);this command hides an object named "Square" at instant t=3s.show()Example: $fig_anim->{objects}->{Square}->hide(4);this command makes an object named "Square" appear at instant t=4s.CHANGEchangeThickness()Example: $fig_anim->{objects}->{Square}->changeThickness(0, 1, 7);animates (with linear interpolation) the thickness of an object named "Square" from time t=0s for a duration of 1s. The thickness will have a value of 7 at the end of the animation.changeFillIntensity()Example: $fig_anim->{objects}->{Square}->changeFillIntensity(2, 1, 0);animates (with linear interpolation) the fill intensity of an object named "Square" from time t=2s for a duration of 1s. The intensity will have a value of 0 at the end of the animation. The intensity must be a number between 0 (black) and 20 (full saturation of the color). In the example the object becomes darker and darker until it becomes black.scale()Example: $fig_anim->{objects}->{Arc}->scale(0, 1, 1.2);scales the object named "Arc" from time t=0s for a duration of 1s according to scale factor 1.2. The center of the scale is the center of the object.MOVEMENTStranslate()Example: $fig_anim->{objects}->{Square}->translate(0, 1, 2, 3, 'in');translates the object named "Square" from time t=0s for a duration of 1s according to vector (2in, 3in). Possible values for units (last parameter) are 'in', 'cm' or 'px'. Units are Fig units if none specified.rotate()Example: $fig_anim->{objects}->{Arc}->rotate(0, 1, -330);rotates the object named "Arc" from time t=0s for a duration of 1s according to rotation angle -330 degrees. In this case the center of the rotation is the center of the object. $fig_anim->{objects}->{Ellipse}->rotate(0, 1, -330, 2, 3,'in');rotates the object named "Arc" from time t=0s for a duration of 1s according to rotation angle -330 degrees. In this case the center of the rotation is point (2in, 3in). Possible values for units (last parameter) are 'in', 'cm' or 'px'. Units are Fig units if none specified.FILE GENERATIONgenerateGif()Example: $fig_anim->generateGif("anim.gif", 10, 1);generates an animated GIF file named "anim.gif" with 10 frames per second, with only one loop (1). If you put a higher number of frames, the animation will be smoother but will take more time to be generated and the file size will be bigger. If you put a lower number of frames, the file will be generated faster and it's size will be smaller but the animation will be less smooth.Another example: $fig_anim->generateGif("anim.gif", 10, 0, 1);generates a GIF file named "anim.gif" with 10 frames per second, with infinite loop (0), and waits for 1s at the end of each loop. The last parameter is optional, if ommited its value is 0 (no waiting).writeSVGfile()Example: $fig_anim->writeSVGFile("file.svg");generates a SVG file named "file.svg" from a FIG file. This is a graphic filter with no animations.generateSMIL()Example: $fig_anim->generateSMIL("file.svg");generates a SVG+SMIL file named "file.svg", it is an animated SVG file with SMIL tags. For now only the Adobe SVG plugin can display animated SVG+SMIL files.Requirements:· Perl Requirements: · Perl


FigAnim Related Software