#bease
##Install
$ npm install bease
##Use
import Ease from 'ease/source/BezierEase';
import Interval from 'ease/source/Interval';
const ease = Ease.EaseIn();
const y = ease.yOfX(0.5);
const interval = new Interval(0.0, 60.0, 0.0, 100.0, ease);
const n = interval.nOfT(30.0);
Table of Contents
BezierEase
Bezier easing curve
constructor
Creates a new instance
Parameters
x0
number The x coordinate of the second control pointy0
number The y coordinate of the second control pointx1
number The x coordinate of the third control pointy1
number The y coordinate of the third control point
define
Redefines the instance
Parameters
x1
number The x coordinate of the second control pointy1
number The y coordinate of the second control pointx2
number The x coordinate of the third control pointy2
number The y coordinate of the third control point
Returns BezierEase
x1
The x coordinate of the second control point
y1
The y coordinate of the second control point
x2
The x coordinate of the third control point
y2
The y coordinate of the third control point
xOfT
Returns the x of t p(t) = (1-t)³p0 + 3t(1-t)²p1 + 3t²(1-t)p2 + t³p3 => 3t(1-t)²p1 + 3t²(1-t)p2 + t³ <=> (1-3p2+3p1)t³ + (3p2-6p1)t² + (3p1)t => at³ + bt² + ct
Parameters
t
number The time
Returns number
yOfT
Returns the y of t p(t) = (1-t)³p0 + 3t(1-t)²p1 + 3t²(1-t)p2 + t³p3 => 3t(1-t)²p1 + 3t²(1-t)p2 + t³ <=> (1-3p2+3p1)t³ + (3p2-6p1)t² + (3p1)t => at³ + bt² + ct
Parameters
t
number The time
Returns number
tOfX
Returns the t of x
Parameters
x
number The x coordinate
Returns number
tOfY
Returns the t of y
Parameters
y
number The y coordinate
Returns number
xOfY
Returns the x of y
Parameters
y
number The y coordinate
Returns number
yOfX
Returns the y of x
Parameters
x
number The x coordinate
Returns number
toString
Returns a string representation of the instance
Parameters
digits
int? The decimal places (optional, default3
)
Returns string
Define
Returns a defined instance
Parameters
x1
number The x coordinate of the second control pointy1
number The y coordinate of the second control pointx2
number The x coordinate of the third control pointy2
number The y coordinate of the third control pointtarget
BezierEase? The target instance
Returns BezierEase
Linear
Returns a instance representing the (0.0,0.0,1.0,1.0) bezier curve
Parameters
target
BezierEase? The target instance
Returns BezierEase
Ease
Returns a instance representing the (0.25,0.1,0.25,1.0) bezier curve
Parameters
target
BezierEase? The target instance
Returns BezierEase
EaseIn
Returns a instance representing the (0.42,0.0,1.0,1.0) bezier curve
Parameters
target
BezierEase? The target instance
Returns BezierEase
EaseOut
Returns a instance representing the (0.0,0.0,0.58,1.0) bezier curve
Parameters
target
BezierEase? The target instance
Returns BezierEase
EaseInOut
Returns a instance representing the (0.42,0.0,0.58,1.0) bezier curve
Parameters
target
BezierEase? The target instance
Returns BezierEase
isEQ
Returns true if a == b, false otherwise
Parameters
a
BezierEase The protagonistb
BezierEase The antagonist
Returns boolean
Interval
Transformation interval
constructor
Creates a new instance
Parameters
t0
number The first interval offsettDelta
number The interval durationn0
number The first interval statenDelta
number The interval magnitudeease
BezierEase The interval easing
t0
The first interval state
tDelta
The interval duration
n0
The first interval state
nDelta
The interval magnitude
ease
The interval easing
define
Redefines the instance
Parameters
t0
number The first interval offsettDelta
number The interval durationn0
number The first interval statenDelta
number The interval magnitudeease
BezierEase The interval easing
Returns Interval
tN
The last interval offset
nN
The last interval state
fOfT
Returns the unclamped interval duration fraction
Parameters
t
number The time
Returns number
nOfT
Returns the clamped interval state
Parameters
t
number The time
Returns number
nOfF
Returns the unclamped interval state
Parameters
f
number The interval duration fraction
Returns number
toString
Returns a string representation of the instance
Parameters
digits
int? The representation digits (optional, default3
)
Returns string
Define
Returns a defined instance
Parameters
t0
number The first interval offsettDelta
number The interval durationn0
number The first interval statenDelta
number The interval magnitudeease
BezierEase? The interval easingtarget
Interval? The target instance
Returns Interval
Extremes
Returns an instance from interval extremes
Parameters
t0
number The first interval offsettN
number The last interval offsetn0
number The first interval statenN
number The last interval stateease
BezierEase? The interval easingtarget
Interval? The target instance
Returns Interval