1.1.1 • Published 2 years ago

transition-timing v1.1.1

Weekly downloads
1
License
MIT
Repository
-
Last release
2 years ago

Transition Timing Functions

This library provides convenient methods that generating a transition timing function such as easing or steps.

Installation

npm install transition-timing
import { easing } from 'transition-timing';

const ease = easing('ease');

Usage

TimingFunction

/**
 * Timing function type.
 *
 * @param {number} t time ratio. from 0 to 1.
 * @returns {number} output ratio. from 0 to 1.
 */
type TimingFunction = (t: number) => number;

cubicBezier

This is method that renamed from the bezier-easing.

function cubicBezier(mX1: number, mY1: number, mX2: number, mY2: number): TimingFunction;

easing

This is helper method for cubicBezier.

function easing(arg: string|number|[number, number, number, number], ...args: number[]): TimingFunction;

Examples

Please see information for keywords for common timing functions

// using same as cubicBezier.
let ease = easing(0.25, 0.1, 0.25, 1);
let easeIn = easing([0.42, 0, 1, 1]);

// also can using by common keywords.
// common keywords: 'linear', 'ease', 'easeIn', 'easeOut' and 'easeInOut'.
let easeOut = easing('easeOut');

steps

Please see information for the steps timing functions

function steps(num: number, direction: 'start'|'end'): TimingFunction;

References

License

The MIT License

1.1.1

2 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago