This file contains hidden or 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
import traverse from "@babel/traverse"; | |
import t from "@babel/types"; | |
traverse(ast, { | |
FunctionDeclaration: function (path) { | |
// path.node(FunctionDeclaration) | |
path.insertAfter(t.variableDeclaration("var", [ | |
t.variableDeclarator( | |
t.identifier("__proto"), | |
t.memberExpression(t.identifier("Item"), t.identifier("prototype")) |
This file contains hidden or 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
\ | component.js | axes.js | flicking.js | |
---|---|---|---|---|
Before | 3.28kb | 56.2kb | 80.3kb | |
After | 1.98kb | 40.53kb | 57kb | |
Improvement rate(%) | 40% | 28% | 29% |
This file contains hidden or 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
import babel from "rollup-plugin-babel"; | |
import typescript from "rollup-plugin-typescript"; | |
import uglify from "rollup-plugin-uglify"; | |
import minify from "rollup-plugin-prototype-minify"; | |
export default { | |
input: 'src/index.ts', | |
plugins: [babel()], // or typescript() | |
output: { | |
banner, |
This file contains hidden or 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
var TRANSFORM = "trasnform"; | |
var ANIMATION = "animation"; | |
var DIRECTION_LEFT = 1; | |
var ALTERNATE_REVERSE = "alternate-reverse"; | |
TRASNFORM; | |
ANIMATION; | |
DIRECTION_LEFT; | |
ALTERNATE_REVERSE; |
This file contains hidden or 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
import babel from "rollup-plugin-babel"; | |
import typescript from "rollup-plugin-typescript"; | |
import uglify from "rollup-plugin-uglify"; | |
import minify from "rollup-plugin-prototype-minify"; | |
export default [ | |
{ | |
input: 'src/index.ts', | |
plugins: [babel()], // or typescript() | |
output: { |
This file contains hidden or 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
.animate { | |
animation-name: keyframes1; | |
animation-duration: 4; | |
animation-iteration-count: 3; | |
animation-timing-function: ease-in-out; | |
} | |
@keyframes keyframes1 { | |
0% { | |
left: 0%; | |
} |
This file contains hidden or 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
new Scene({ | |
".animte": { | |
0: { | |
left: "0%", | |
}, | |
2: { | |
left: "50%", | |
}, | |
4: { | |
left: "30%", |
This file contains hidden or 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
// b.js | |
function a() { | |
} | |
function b() { | |
a(); | |
} |
This file contains hidden or 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
new Scene.SceneItem({ | |
0: { | |
number: 0, | |
stringWithUnit: "0px", | |
color: "#ff5555", | |
function: 0, | |
array: [0, 50, 100], | |
object: {"a": 1, "b": 2}, | |
etc: "A", | |
}, |
This file contains hidden or 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
/* CSS Easing */ | |
{ | |
easing: Scene.EASE_IN, // EASE_OUT, EASE_IN_OUT, ... | |
} | |
/* Custom */ | |
{ | |
easing: t => 1 - Math.pow(t, 3), | |
} |