Published
Edited
Sep 20, 2019
Fork of eases
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function backIn(t) {
var s = 1.70158;
return t * t * (t - s + s * t);
}
Insert cell
Insert cell
function backInOut(t) {
const s = 1.70158 * 1.525;
const sign = (t > 0.5) - (t < 0.5);
t = (2*t - 1)*sign - 1;
return 0.5 * (1 + sign + sign * t * t * (t + s + s * t));
}
Insert cell
Insert cell
function backOut(t) {
var s = 1.70158;
t -= 1;
return t * t * (t + s + s * t) + 1;
}
Insert cell
Insert cell
function bounceIn(t) {
return 1.0 - bounceOut(1.0 - t);
}
Insert cell
Insert cell
function bounceInOut(t) {
const sign = (t > 0.5) - (t < 0.5);
t = (2*t - 1)*sign;
return 0.5 * (1 + sign * bounceOut(t));
}
Insert cell
Insert cell
bounceOut = {
const a = 4.0 / 11.0, b = 8.0 / 11.0, c = 9.0 / 10.0;
const coeffs = new Float64Array([
7.5625, 0, 0,
9.075, -9.9, 3.4,
4356.0 / 361.0, -35442.0 / 1805.0, 16061.0 / 1805.0,
10.8, -20.52, 10.72
]);

return function bounceOut(t) {
const i = 3 * ((t > a) + (t > b) + (t > c));
return t * (t * coeffs[i] + coeffs[i+1]) + coeffs[i+2];
}
}
Insert cell
Insert cell
function circIn(t) {
return 1.0 - Math.sqrt(1.0 - t * t);
}
Insert cell
Insert cell
function circInOut(t) {
const sign = (t > 0.5) - (t < 0.5);
t = 2 * t - 1 - sign;
return 0.5 * (1 + sign * Math.sqrt(1 - t * t))
}
Insert cell
Insert cell
function circOut(t) {
t -= 1;
return Math.sqrt(1 - t * t);
}
Insert cell
Insert cell
function cubicIn(t) {
return t * t * t;
}
Insert cell
Insert cell
function cubicInOut(t) {
const out = +(t > 0.5);
t = 2.0 * (t - out);
return 0.5 * t * t * t + out;
}
Insert cell
Insert cell
function cubicOut(t) {
t = 1.0 - t;
return - t * t * t;
}
Insert cell
Insert cell
function elasticIn(t) {
return Math.sin(6.5 * Math.PI * t) * Math.pow(2.0, 10.0 * (t - 1.0));
}
Insert cell
Insert cell
function elasticInOut(t) {
return t < 0.5
? 0.5 *
Math.sin(13.0 * Math.PI * t) *
Math.pow(2.0, 10.0 * (2.0 * t - 1.0))
: 0.5 *
Math.sin(-13.0 * Math.PI * t) *
Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) +
1.0;
}
Insert cell
Insert cell
function elasticOut(t) {
return (
Math.sin(-6.5 * Math.PI * (t + 1.0)) * Math.pow(2.0, -10.0 * t) + 1.0
);
}
Insert cell
Insert cell
function expoIn(t) {
return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0));
}
Insert cell
Insert cell
function expoInOut(t) {
return t === 0.0 || t === 1.0
? t
: t < 0.5
? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)
: -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;
}
Insert cell
Insert cell
function expoOut(t) {
return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t);
}
Insert cell
Insert cell
function linear(t) {
return t;
}
Insert cell
Insert cell
function quadIn(t) {
return t * t;
}
Insert cell
Insert cell
function quadInOut(t) {
const sign = (t > 0.5) - (t < 0.5);
t = 2 * t - 1 - sign;
return 0.5 * (1 + sign * (1 - t * t));
}
Insert cell
Insert cell
function quadOut(t) {
t = 1 - t;
return - t * t;
}
Insert cell
Insert cell
function quartIn(t) {
t *= t;
return t * t;
}
Insert cell
Insert cell
function quartInOut(t) {
const sign = (t > 0.5) - (t < 0.5);
t = 2 * t - 1 - sign;
t *= t;
return 0.5 * (1 + sign - sign * t * t);
}
Insert cell
Insert cell
function quartOut(t) {
t = 1 - t;
t *= t;
return - t * t;
}
Insert cell
Insert cell
function quintIn(t) {
const s = t * t;
return s * s * t;
}
Insert cell
Insert cell
function quintInOut(t) {
const out = +(t > 0.5);
t = 2.0 * (t - out);
const s = t * t;
return 0.5 * s * s * t + out;
}
Insert cell
Insert cell
function quintOut(t) {
t = 1 - t;
const s = t * t;
return - s * s * t;
}
Insert cell
Insert cell
function sineIn(t) {
return 1 - Math.sin(0.5 * Math.PI * (1 - t));
}
Insert cell
Insert cell
function sineInOut(t) {
return 0.5 * (1 - Math.cos(Math.PI * t));
}
Insert cell
Insert cell
function sineOut(t) {
return Math.sin(0.5 * Math.PI * t);
}
Insert cell
Insert cell
stdlib = require('https://unpkg.com/@stdlib/stdlib@0.0.85/dist/stdlib-flat.min.js')
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more