ColorPlugin Class
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
()
Item Index
Properties
- _mode static
- COLOR_RE static
- HEX_RE static
- ID static
- RGB_HSL_RE static
Methods
change
-
tween
-
step
-
prop
-
value
-
ratio
-
end
Called before a property is updated by the tween. See change for more info.
Returns:
init
-
tween
-
prop
-
value
Called by TweenJS when a new property initializes on a tween. See init for more info.
Returns:
install
-
mode
Installs this plugin for use with TweenJS. Call this once after TweenJS is loaded to enable this plugin.
Parameters:
-
mode
StringA 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.
Properties
HEX_RE
RegExp
static
readonly
READ-ONLY. RegExp pattern that matches a 3 or 6 digit RGB string with a preceding #.
ID
String
static
readonly
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
READ-ONLY. RegExp pattern that matches rgb or hsl color strings, with groups for each value.