new aniPNG(parameters, callback);

Instantiates the JavaScript object using the “imgName” parameter.


  • container:The id of the containing element of the animation [required]
  • imgName:The name of the animation object [required]
  • firstImage:The filename of the first image of the animation <alpha><numeric>.<ext> [required]
  • imgCount:The total number of frames in the animation [required]
  • delay:The number of milliseconds to wait between each frame of the animation (defaults to 0) [optional]
  • direction:The direction of the animation (defaults to forward) [optional]
  • repeat:Does the animation repeat (defaults to false) [optional]
  • callback:Function to return onComplete [optional]


The callback function can be specified as part of the parameters object (above) or separately.


var sequence = new aniPNG({
    "container":    'sample id here',
    "imgName":      'animation name',
    "firstImage":   'fielpath/filename.png',
    "imgCount":     100,
    "delay":        10,
    "direction":    "forward|reverse",
    "repeat":       false
    //"callback":   myFunction
}, myFunction);

You can either call the global functions independently:


or, you can chain the functions:


Core Methods



Draws the animation in the page. This can be called directly after the constructor, or after other function calls if you wish to alter the animation’s settings before it is drawn.


  • delayStart:If set to false (default), the animation will be started immediately. If true, the animation will not be started until startAnimation() is called. You can add startAnimation() to the onload attribute to delay the animation until the whole page has loaded.



Does not animate. This jumps to the specified frame immediately.


  • frame:The target frame number.



Specifies whether or not the animation should repeat when it completes. If the repeat is set to true when the animation is not running, it will be restarted.


  • boolean:Pass true to enable repeating animation; false to disable the repeat. Default is false.


    .setFrameDelay(frame, delay);

Sets the delay for an individual frame of the animation. This will override the delay specified in the constructor for this frame. You can either use individual values for each parameter of pass an array to both.


  • frame:The frame number for which the delay will be set. Can also be an array of frames.
  • delay:The frame delay, in milliseconds. Can be a single value, or in the case of an array of frames you can optionally add an array of delays.



Restarts the animation if it has been stopped. If draw’s parameter is set to true, the animation will not be started until startAnimation() is called.


  • delayBegin:Delay the beginning of the animation in milliseconds. Default is 0.



Stops the animation on the current frame.