Skip to content

Commit 7a3a59f

Browse files
committed
- rename easing-fit.js, easing-fit.min.js to index.js and
`index.min.js` - upgrade modules - release with compact directory structure - add `main` and `browser` field in `package.json`. - further minimize generated js file with mangling and compression - bump version
1 parent 5e0b5e0 commit 7a3a59f

File tree

12 files changed

+2651
-833
lines changed

12 files changed

+2651
-833
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Change Logs
2+
3+
## v0.0.2
4+
5+
- rename `easing-fit.js`, `easing-fit.min.js` to `index.js` and `index.min.js`
6+
- upgrade modules
7+
- release with compact directory structure
8+
- add `main` and `browser` field in `package.json`.
9+
- further minimize generated js file with mangling and compression
10+

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ Fit any easing function with keyframes and cubic-bezier timing function.
44

55
For example, assume we have an equation for a bouncing ball's height:
66

7-
```
87
Math.abs(Math.sin(Math.pow(3 * t + 1.77, 2)) / ( Math.pow(3 * t + 2, 5 * t) + 1))
9-
```
108

119

1210
instead of simply sampling it with fixed interval of t, easing-fit breaks it into pieces of cubic bezier spline:
1311

14-
```
1512
@keyframes bouncing {
1613
0% {
1714
animation-timing-function: cubic-bezier(0,0.5,1,0.6);
@@ -53,32 +50,27 @@ instead of simply sampling it with fixed interval of t, easing-fit breaks it int
5350
transform: translate(0px);
5451
}
5552
}
56-
```
5753

5854

5955
## Usage
6056

6157
First, import easing-fit and use it to create a keyframes object for our customized easing function:
6258

63-
```
6459
easingFit = require("easing-fit");
6560
customFunc = function(t) {
6661
return Math.sin(t * Math.PI * 2);
6762
};
6863
keyframes = easingFit.fit(customFunc, {});
69-
```
7064

7165
The keyframes object contains all information needed. Then, convert it to CSS keyframe string with this help function:
7266

73-
```
7467
var result = easingFit.toKeyframes(keyframes, {
7568
format: "css",
7669
prop: function(keyframe,config, idx) { return {"transform": "translate(" + keyframe.value + ")"}; },
7770
name: "sine",
7871
config: {.../* custom defined config */ }
7972
});
8073
/* result is the result CSS content */
81-
```
8274

8375
Be sure to add your own prop function for converting value into CSS property. You can also check sample.ls for more detail.
8476

build

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/usr/bin/env bash
2+
rm -rf dist
23
mkdir -p dist
3-
echo "build src/index.ls -> dist/easing-fit.js ..."
4-
./node_modules/.bin/lsc -cbp src/index.ls > dist/easing-fit.js
5-
echo "bundling easing-fit.js ..."
6-
./node_modules/.bin/browserify dist/easing-fit.js > dist/easing-fit.bundle.js
7-
#./node_modules/.bin/browserify dist/easing-fit.js | \
8-
# ./node_modules/.bin/babel --no-babelrc --presets=env > dist/easing-fit.bundle.js
9-
echo "minifying easing-fit.js ..."
10-
./node_modules/.bin/uglifyjs dist/easing-fit.js > dist/easing-fit.min.js
11-
echo "minifying easing-fit.bundle.js ..."
12-
./node_modules/.bin/uglifyjs dist/easing-fit.bundle.js > dist/easing-fit.bundle.min.js
4+
echo "build src/index.ls -> dist/index.js ..."
5+
./node_modules/.bin/lsc -cp --no-header src/index.ls > dist/index.js
6+
echo "bundling index.js ..."
7+
./node_modules/.bin/browserify dist/index.js > dist/index.bundle.js
8+
#./node_modules/.bin/browserify dist/index.js | \
9+
# ./node_modules/.bin/babel --no-babelrc --presets=env > dist/index.bundle.js
10+
echo "minifying index.js ..."
11+
./node_modules/.bin/uglifyjs dist/index.js -m -c > dist/index.min.js
12+
echo "minifying index.bundle.js ..."
13+
./node_modules/.bin/uglifyjs dist/index.bundle.js -m -c > dist/index.bundle.min.js
1314
echo "done."

dist/easing-fit.bundle.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/easing-fit.js

Lines changed: 0 additions & 262 deletions
This file was deleted.

dist/easing-fit.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)