Smooth color transitions
Experimental module
$ npm install --save color-transitions
const colorTransitions = require('color-transitions');
colorTransitions('blue', 'red', color => {
// `color` will be the color value between 'blue' and 'red'
});
Same as the color setter.
Type: number
Default: 1000
The transition duration option specifies the number of seconds or milliseconds a transition animation should take to complete.
Type: string
or function
Default: 'linear'
The transition timing function option is used to describe how the intermediate values of the color being affected by a transition effect are calculated. This in essence lets you establish an acceleration curve, so that the speed of the transition can vary over its duration.
If this is string, the function would be from eases.
Type: number
Default: 60
Maximum number of callbacks that can occur in one second.
Type: number
or boolean
Default: 1
How many transitions between two colors. Specify true
to make it infinite.
Type: function
Callback function. If return false
, stop immediately.
Type: array
RGB array
Type: number
How much time has passed since last callback in milliseconds.
Type: number
Which iteration. Counting from 1.
Type: boolean
Is the transition done?
MIT © Steve Mao