forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
188 changed files
with
32,205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from '../types/runtime/animate/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var easing = require('../easing'); | ||
var internal = require('../internal'); | ||
|
||
function flip(node, animation, params) { | ||
const style = getComputedStyle(node); | ||
const transform = style.transform === 'none' ? '' : style.transform; | ||
const dx = animation.from.left - animation.to.left; | ||
const dy = animation.from.top - animation.to.top; | ||
const d = Math.sqrt(dx * dx + dy * dy); | ||
const { delay = 0, duration = d => Math.sqrt(d) * 120, easing: easing$1 = easing.cubicOut } = params; | ||
return { | ||
delay, | ||
duration: internal.is_function(duration) ? duration(d) : duration, | ||
easing: easing$1, | ||
css: (_t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);` | ||
}; | ||
} | ||
|
||
exports.flip = flip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { cubicOut } from '../easing'; | ||
import { is_function } from '../internal'; | ||
|
||
function flip(node, animation, params) { | ||
const style = getComputedStyle(node); | ||
const transform = style.transform === 'none' ? '' : style.transform; | ||
const dx = animation.from.left - animation.to.left; | ||
const dy = animation.from.top - animation.to.top; | ||
const d = Math.sqrt(dx * dx + dy * dy); | ||
const { delay = 0, duration = d => Math.sqrt(d) * 120, easing = cubicOut } = params; | ||
return { | ||
delay, | ||
duration: is_function(duration) ? duration(d) : duration, | ||
easing, | ||
css: (_t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);` | ||
}; | ||
} | ||
|
||
export { flip }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"main": "./index", | ||
"module": "./index.mjs", | ||
"types": "./index.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './types/compiler/index'; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from '../types/runtime/easing/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var internal = require('../internal'); | ||
|
||
/* | ||
Adapted from https://github.com/mattdesl | ||
Distributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md | ||
*/ | ||
function backInOut(t) { | ||
const s = 1.70158 * 1.525; | ||
if ((t *= 2) < 1) | ||
return 0.5 * (t * t * ((s + 1) * t - s)); | ||
return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); | ||
} | ||
function backIn(t) { | ||
const s = 1.70158; | ||
return t * t * ((s + 1) * t - s); | ||
} | ||
function backOut(t) { | ||
const s = 1.70158; | ||
return --t * t * ((s + 1) * t + s) + 1; | ||
} | ||
function bounceOut(t) { | ||
const a = 4.0 / 11.0; | ||
const b = 8.0 / 11.0; | ||
const c = 9.0 / 10.0; | ||
const ca = 4356.0 / 361.0; | ||
const cb = 35442.0 / 1805.0; | ||
const cc = 16061.0 / 1805.0; | ||
const t2 = t * t; | ||
return t < a | ||
? 7.5625 * t2 | ||
: t < b | ||
? 9.075 * t2 - 9.9 * t + 3.4 | ||
: t < c | ||
? ca * t2 - cb * t + cc | ||
: 10.8 * t * t - 20.52 * t + 10.72; | ||
} | ||
function bounceInOut(t) { | ||
return t < 0.5 | ||
? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0)) | ||
: 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5; | ||
} | ||
function bounceIn(t) { | ||
return 1.0 - bounceOut(1.0 - t); | ||
} | ||
function circInOut(t) { | ||
if ((t *= 2) < 1) | ||
return -0.5 * (Math.sqrt(1 - t * t) - 1); | ||
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1); | ||
} | ||
function circIn(t) { | ||
return 1.0 - Math.sqrt(1.0 - t * t); | ||
} | ||
function circOut(t) { | ||
return Math.sqrt(1 - --t * t); | ||
} | ||
function cubicInOut(t) { | ||
return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0; | ||
} | ||
function cubicIn(t) { | ||
return t * t * t; | ||
} | ||
function cubicOut(t) { | ||
const f = t - 1.0; | ||
return f * f * f + 1.0; | ||
} | ||
function elasticInOut(t) { | ||
return t < 0.5 | ||
? 0.5 * | ||
Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) * | ||
Math.pow(2.0, 10.0 * (2.0 * t - 1.0)) | ||
: 0.5 * | ||
Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) * | ||
Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) + | ||
1.0; | ||
} | ||
function elasticIn(t) { | ||
return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0)); | ||
} | ||
function elasticOut(t) { | ||
return (Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0); | ||
} | ||
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; | ||
} | ||
function expoIn(t) { | ||
return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0)); | ||
} | ||
function expoOut(t) { | ||
return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t); | ||
} | ||
function quadInOut(t) { | ||
t /= 0.5; | ||
if (t < 1) | ||
return 0.5 * t * t; | ||
t--; | ||
return -0.5 * (t * (t - 2) - 1); | ||
} | ||
function quadIn(t) { | ||
return t * t; | ||
} | ||
function quadOut(t) { | ||
return -t * (t - 2.0); | ||
} | ||
function quartInOut(t) { | ||
return t < 0.5 | ||
? +8.0 * Math.pow(t, 4.0) | ||
: -8.0 * Math.pow(t - 1.0, 4.0) + 1.0; | ||
} | ||
function quartIn(t) { | ||
return Math.pow(t, 4.0); | ||
} | ||
function quartOut(t) { | ||
return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0; | ||
} | ||
function quintInOut(t) { | ||
if ((t *= 2) < 1) | ||
return 0.5 * t * t * t * t * t; | ||
return 0.5 * ((t -= 2) * t * t * t * t + 2); | ||
} | ||
function quintIn(t) { | ||
return t * t * t * t * t; | ||
} | ||
function quintOut(t) { | ||
return --t * t * t * t * t + 1; | ||
} | ||
function sineInOut(t) { | ||
return -0.5 * (Math.cos(Math.PI * t) - 1); | ||
} | ||
function sineIn(t) { | ||
const v = Math.cos(t * Math.PI * 0.5); | ||
if (Math.abs(v) < 1e-14) | ||
return 1; | ||
else | ||
return 1 - v; | ||
} | ||
function sineOut(t) { | ||
return Math.sin((t * Math.PI) / 2); | ||
} | ||
|
||
Object.defineProperty(exports, 'linear', { | ||
enumerable: true, | ||
get: function () { | ||
return internal.identity; | ||
} | ||
}); | ||
exports.backIn = backIn; | ||
exports.backInOut = backInOut; | ||
exports.backOut = backOut; | ||
exports.bounceIn = bounceIn; | ||
exports.bounceInOut = bounceInOut; | ||
exports.bounceOut = bounceOut; | ||
exports.circIn = circIn; | ||
exports.circInOut = circInOut; | ||
exports.circOut = circOut; | ||
exports.cubicIn = cubicIn; | ||
exports.cubicInOut = cubicInOut; | ||
exports.cubicOut = cubicOut; | ||
exports.elasticIn = elasticIn; | ||
exports.elasticInOut = elasticInOut; | ||
exports.elasticOut = elasticOut; | ||
exports.expoIn = expoIn; | ||
exports.expoInOut = expoInOut; | ||
exports.expoOut = expoOut; | ||
exports.quadIn = quadIn; | ||
exports.quadInOut = quadInOut; | ||
exports.quadOut = quadOut; | ||
exports.quartIn = quartIn; | ||
exports.quartInOut = quartInOut; | ||
exports.quartOut = quartOut; | ||
exports.quintIn = quintIn; | ||
exports.quintInOut = quintInOut; | ||
exports.quintOut = quintOut; | ||
exports.sineIn = sineIn; | ||
exports.sineInOut = sineInOut; | ||
exports.sineOut = sineOut; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
export { identity as linear } from '../internal'; | ||
|
||
/* | ||
Adapted from https://github.com/mattdesl | ||
Distributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md | ||
*/ | ||
function backInOut(t) { | ||
const s = 1.70158 * 1.525; | ||
if ((t *= 2) < 1) | ||
return 0.5 * (t * t * ((s + 1) * t - s)); | ||
return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2); | ||
} | ||
function backIn(t) { | ||
const s = 1.70158; | ||
return t * t * ((s + 1) * t - s); | ||
} | ||
function backOut(t) { | ||
const s = 1.70158; | ||
return --t * t * ((s + 1) * t + s) + 1; | ||
} | ||
function bounceOut(t) { | ||
const a = 4.0 / 11.0; | ||
const b = 8.0 / 11.0; | ||
const c = 9.0 / 10.0; | ||
const ca = 4356.0 / 361.0; | ||
const cb = 35442.0 / 1805.0; | ||
const cc = 16061.0 / 1805.0; | ||
const t2 = t * t; | ||
return t < a | ||
? 7.5625 * t2 | ||
: t < b | ||
? 9.075 * t2 - 9.9 * t + 3.4 | ||
: t < c | ||
? ca * t2 - cb * t + cc | ||
: 10.8 * t * t - 20.52 * t + 10.72; | ||
} | ||
function bounceInOut(t) { | ||
return t < 0.5 | ||
? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0)) | ||
: 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5; | ||
} | ||
function bounceIn(t) { | ||
return 1.0 - bounceOut(1.0 - t); | ||
} | ||
function circInOut(t) { | ||
if ((t *= 2) < 1) | ||
return -0.5 * (Math.sqrt(1 - t * t) - 1); | ||
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1); | ||
} | ||
function circIn(t) { | ||
return 1.0 - Math.sqrt(1.0 - t * t); | ||
} | ||
function circOut(t) { | ||
return Math.sqrt(1 - --t * t); | ||
} | ||
function cubicInOut(t) { | ||
return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0; | ||
} | ||
function cubicIn(t) { | ||
return t * t * t; | ||
} | ||
function cubicOut(t) { | ||
const f = t - 1.0; | ||
return f * f * f + 1.0; | ||
} | ||
function elasticInOut(t) { | ||
return t < 0.5 | ||
? 0.5 * | ||
Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) * | ||
Math.pow(2.0, 10.0 * (2.0 * t - 1.0)) | ||
: 0.5 * | ||
Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) * | ||
Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) + | ||
1.0; | ||
} | ||
function elasticIn(t) { | ||
return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0)); | ||
} | ||
function elasticOut(t) { | ||
return (Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0); | ||
} | ||
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; | ||
} | ||
function expoIn(t) { | ||
return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0)); | ||
} | ||
function expoOut(t) { | ||
return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t); | ||
} | ||
function quadInOut(t) { | ||
t /= 0.5; | ||
if (t < 1) | ||
return 0.5 * t * t; | ||
t--; | ||
return -0.5 * (t * (t - 2) - 1); | ||
} | ||
function quadIn(t) { | ||
return t * t; | ||
} | ||
function quadOut(t) { | ||
return -t * (t - 2.0); | ||
} | ||
function quartInOut(t) { | ||
return t < 0.5 | ||
? +8.0 * Math.pow(t, 4.0) | ||
: -8.0 * Math.pow(t - 1.0, 4.0) + 1.0; | ||
} | ||
function quartIn(t) { | ||
return Math.pow(t, 4.0); | ||
} | ||
function quartOut(t) { | ||
return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0; | ||
} | ||
function quintInOut(t) { | ||
if ((t *= 2) < 1) | ||
return 0.5 * t * t * t * t * t; | ||
return 0.5 * ((t -= 2) * t * t * t * t + 2); | ||
} | ||
function quintIn(t) { | ||
return t * t * t * t * t; | ||
} | ||
function quintOut(t) { | ||
return --t * t * t * t * t + 1; | ||
} | ||
function sineInOut(t) { | ||
return -0.5 * (Math.cos(Math.PI * t) - 1); | ||
} | ||
function sineIn(t) { | ||
const v = Math.cos(t * Math.PI * 0.5); | ||
if (Math.abs(v) < 1e-14) | ||
return 1; | ||
else | ||
return 1 - v; | ||
} | ||
function sineOut(t) { | ||
return Math.sin((t * Math.PI) / 2); | ||
} | ||
|
||
export { backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, cubicIn, cubicInOut, cubicOut, elasticIn, elasticInOut, elasticOut, expoIn, expoInOut, expoOut, quadIn, quadInOut, quadOut, quartIn, quartInOut, quartOut, quintIn, quintInOut, quintOut, sineIn, sineInOut, sineOut }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"main": "./index", | ||
"module": "./index.mjs", | ||
"types": "./index.d.ts" | ||
} |
Oops, something went wrong.