search

goog.fx.CssSpriteAnimation

Provided By
Extends
All Implemented Interfaces

This animation class is used to animate a CSS sprite (moving a background image). This moves through a series of images in a single image sprite. By default, the animation loops when done. Looping can be disabled by setting opt_disableLoop and results in the animation stopping on the last image in the image sprite. You should set up the background-image and size in a CSS rule for the relevant element.

new CssSpriteAnimation( element, size, box, time, opt_acc, opt_disableLoop )

Parameters
element(Element|null)

The HTML element to animate the background for.

size(goog.math.Size|null)

The size of one image in the image sprite.

box(goog.math.Box|null)

The box describing the layout of the sprites to use in the large image. The sprites can be position horizontally or vertically and using a box here allows the implementation to know which way to go.

timenumber

The duration in milliseconds for one iteration of the animation. For example, if the sprite contains 4 images and the duration is set to 400ms then each sprite will be displayed for 100ms.

opt_accfunction(number): number=

Acceleration function, returns 0-1 for inputs 0-1. This can be used to make certain frames be shown for a longer period of time.

opt_disableLoopboolean=

Whether the animation should be halted after a single loop of the images in the sprite.

Instance Methods

Instance Properties