API Documentation for: 1.0.0
Show:

ColorPlugin Class

Defined in: ColorPlugin:38
Module: TweenJS

The ColorPlugin enables tweening of almost any CSS color values. This includes 3 or 6 digit hex colors (#00FF00), rgb, rgba, hsl, and hsla colors (but not named colors, such as red).

It can operate in either rgb or hsl mode. It will convert all colors into that mode, and output them accordingly.

Constructor

ColorPlugin

()

Defined in ColorPlugin:38

Item Index

Methods

Properties

Methods

change

(
  • tween
  • step
  • prop
  • value
  • ratio
  • end
)
Any static

Defined in change:147

Called before a property is updated by the tween. See change for more info.

Parameters:

Returns:

Any:

init

(
  • tween
  • prop
  • value
)
Any static

Defined in init:109

Called by TweenJS when a new property initializes on a tween. See init for more info.

Parameters:

Returns:

Any:

install

(
  • mode
)
static

Defined in install:97

Installs this plugin for use with TweenJS. Call this once after TweenJS is loaded to enable this plugin.

Parameters:

  • mode String

    A string equalling either "rgb" or "hsl" indicating what color mode should be used for calculations and output. You can input any color type regardless of the mode setting.

step

(
  • tween
  • step
  • props
)
static

Defined in step:130

Called when a new step is added to a tween (ie. a new "to" action is added to a tween). See step for more info.

Parameters:

Properties

_mode

String protected static

Defined in _mode:79

Default: rgb

COLOR_RE

RegExp static readonly

Defined in COLOR_RE:52

READ-ONLY. RegExp pattern that detects CSS color values.

HEX_RE

RegExp static readonly

Defined in HEX_RE:70

READ-ONLY. RegExp pattern that matches a 3 or 6 digit RGB string with a preceding #.

ID

String static readonly

Defined in ID:88

READ-ONLY. A unique identifying string for this plugin. Used by TweenJS to ensure duplicate plugins are not installed on a tween.

RGB_HSL_RE

RegExp static readonly

Defined in RGB_HSL_RE:61

READ-ONLY. RegExp pattern that matches rgb or hsl color strings, with groups for each value.