Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

ScaleAnimation

MikhailTymchukDX edited this page Apr 12, 2017 · 2 revisions

ScaleAnimation (inherits Animation)

The ScaleAnimation scales the size of the target element by the given scaleFactor (i.e. a scaleFactor of .5 will shrink it in half and a scaleFactor of 2.0 will double it). If scaleFont is true, the size of the font will also scale with the element. If center is true, then the element's center will not move as it is scaled. It is important to note that the target must be positioned (i.e. absolutely) so that setting its top/left properties will change its location in order for center to have an effect.

Client properties

Name Description
center Whether the target should stay centered while scaling.
fontUnit Unit of the font, which is only used if scaleFont is true. The default value is 'pt'.
scaleFactor The amount to scale the target (a scaleFactor of .5 will shrink it in half and a scaleFactor of 2.0 will double it). The default value is 1, which does no scaling.
scaleFont Whether the font should be scaled along with the size.
unit Length unit for the size of the target. The default value is 'px'.

Client methods

Name Description
constructor(target, duration, fps, scaleFactor, unit, center, scaleFont, fontUnit)
getAnimatedValue(percentage) Get the amount to scale the target.
onEnd() The onEnd method is called just after the animation is played each time.
onStart() The onStart method is called just before the animation is played each time.
setValue(scale) Scale the target by the given percentage.

Client properties

center

Whether the target should stay centered while scaling.

Getter name: get_center()
Setter name: set_center(value)

fontUnit

Unit of the font, which is only used if scaleFont is true. The default value is 'pt'.

Getter name: get_fontUnit()
Setter name: set_fontUnit(value)

scaleFactor

The amount to scale the target (a scaleFactor of .5 will shrink it in half and a scaleFactor of 2.0 will double it). The default value is 1, which does no scaling.

Getter name: get_scaleFactore()
Setter name: set_scaleFactore(value)

scaleFont

Whether the font should be scaled along with the size.

Getter name: get_scaleFont()
Setter name: set_scaleFont(value)

unit

Length unit for the size of the target. The default value is 'px'.

Getter name: get_unit()
Setter name: set_unit(value)

Client methods

constructor(target, duration, fps, scaleFactor, unit, center, scaleFont, fontUnit)

Params:

  • target

    • Type: Object
    • Description: Target of the animation.
  • duration

    • Type: Number
    • Description: Length of the animation in seconds. The default is 1.
  • fps

    • Type: Number
    • Description: Number of steps per second. The default is 25.
  • scaleFactor

    • Type: Number
    • Description: The amount to scale the target (a scaleFactor of .5 will shrink it in half and a scaleFactor of 2.0 will double it). The default value is 1, which does no scaling.
  • unit

    • Type: String
    • Description: Length unit for the size of the target. The default value is 'px'.
  • center

    • Type: Boolean
    • Description: Whether the target should stay centered while scaling.
  • scaleFont

    • Type: Boolean
    • Description: Whether the font should be scaled along with the size.
  • fontUnit

    • Type: String
    • Description: Unit of the font, which is only used if scaleFont is true. The default value is 'pt'.

getAnimatedValue(percentage)

Get the amount to scale the target.

Params:

  • percentage
    • Type: Number
    • Description: Percentage of the animation already complete.

onEnd()

The onEnd method is called just after the animation is played each time.

onStart()

The onStart method is called just before the animation is played each time.

setValue(scale)

Scale the target by the given percentage.

Params:

  • scale
    • Type: Number
    • Description: Percentage to scale the target.
Clone this wiki locally