44
55> Lightweight JavaScript (ES6) tweening library.
66
7- ![ ] ( https://travis-ci.org/sasha240100/between.js.svg?branch=master )
8- ![ ] ( https://img.shields.io/npm/v/between.js.svg )
7+ [ ![ ] ( https://travis-ci.org/sasha240100/between.js.svg?branch=master )] ( https://travis-ci.org/sasha240100/between.js )
8+ [ ![ ] ( https://img.shields.io/npm/v/between.js.svg )] ( https://www.npmjs.com/package/between.js )
9+
10+ [ ![ NPM] ( https://nodei.co/npm/between.js.png )] ( https://nodei.co/npm/between.js/ )
911
1012** EXAMPLES**
11- * [ Examples collection] ( http://betweenjs.surge.sh / )
13+ * [ Examples collection] ( http://between.js.org / )
1214
1315** DOCUMENTATION**
14-
15- * [ Purpose] ( #purpose )
16- * [ Installation] ( #install-with-npm )
17- * [ Basic usage] ( #basic-usage )
18- * [ Events] ( #events )
19- * [ Different values] ( #different-values )
20- * [ Looping] ( #looping )
21- * [ Easing] ( #easing )
22- * [ Color] ( #color )
23- * [ Mixed examples] ( #mixed-examples )
24-
25- ## Purpose
16+ - [ Purpose] ( #purpose )
17+ - [ Install] ( #install )
18+ - [ With npm] ( #with-npm )
19+ - [ Or fetch from CDN] ( #or-fetch-from-cdn )
20+ - [ Basic usage] ( #basic-usage )
21+ - [ Module] ( #module )
22+ - [ Or in HTML:] ( #or-in-html )
23+ - [ API] ( #api )
24+ - [ Events] ( #events )
25+ - [ Different values] ( #different-values )
26+ - [ Looping] ( #looping )
27+ - [ Easing] ( #easing )
28+ - [ Color] ( #color )
29+ - [ Mixed examples] ( #mixed-examples )
30+
31+ # Purpose
2632
2733Make tweening usage convenient and powerful. There are certain things that we were following while developed this library, we wanted to make it:
2834
29- - The most ** lightweight ** :snowflake : JS Tweening library.
30- > The library is only ` 8.3 Kb `
31- - The most ** performant ** :zap : JS Tweening library.
35+ - ** Lightweight ** :snowflake : JS Tweening library.
36+ > The library is only ` 8.3 Kb (3Kb gzip) `
37+ - ** Performant ** :zap : JS Tweening library.
3238 > It uses optimization patterns to speed up & smooth animation.
33- - The most ** modern ** :gem : JS Tweening library
39+ - ** Modern ** :gem : JS Tweening library
3440 > The library is written in ` ES6 ` , compiled to ES5 for global browsers support and provides ` ES6 API ` .
3541
36- ## Install with npm
42+ # Install
43+ ## With npm
3744
3845```
3946$ npm install between.js
4047```
4148
42- ## Basic usage
49+ ## Or fetch from CDN
50+
51+ ```
52+ <script src="https://rawgit.com/sasha240100/between.js/master/build/between.js"></script>
53+ ```
4354
55+ # Basic usage
56+ ## Module
4457``` javascript
4558import Between from ' between.js' ;
4659
@@ -51,8 +64,7 @@ new Between(1, 10).time(1000)
5164 });
5265```
5366
54-
55- Or in HTML:
67+ ## Or in HTML:
5668
5769``` html
5870<script src =" ./path/to/between.js" ></script >
@@ -78,11 +90,18 @@ new Between(
7890 .loop ([String ] mode, [? Number ] repeatTimes) // Set loop mode, if "repeatTimes" is falsy, treats as "endless"
7991 .easing ([Function ] easing) // Set easing function
8092 .on ([String ] eventName, [Function ] callback) // Add event listener
93+ .pause () // Pauses
94+ .play () // Resumes
95+
96+ // Getters
97+ .isPaused // returns true if paused
8198` ` `
8299
100+
101+
83102> There is no need to "start" the tween. It is executed immediately once it was created.
84103
85- ## Events
104+ # Events
86105
87106` ` ` javascript
88107import Between from ' between.js' ;
@@ -94,12 +113,18 @@ new Between(1, 10).time(1000)
94113 .on (' start' , (value ) => {
95114 console .log (value);
96115 })
116+ .on (' pause' , (value ) => {
117+ console .log (value);
118+ })
119+ .on (' play' , (value ) => {
120+ console .log (value);
121+ })
97122 .on (' complete' , (value ) => {
98123 console .log (value);
99124 });
100125` ` `
101126
102- ## Different values
127+ # Different values
103128
104129* Numbers
105130* Arrays
@@ -116,7 +141,7 @@ new Between(1, 10).time(1000)
116141 });
117142` ` `
118143
119- [Example](http://betweenjs.surge.sh /basic.html)
144+ [Example](http://between.js.org /basic.html)
120145
121146**Arrays**
122147
@@ -129,7 +154,7 @@ new Between([1, 5], [10, 10]).time(1000)
129154 });
130155` ` `
131156
132- [Example](http://betweenjs.surge.sh /arrays.html)
157+ [Example](http://between.js.org /arrays.html)
133158
134159**Objects**
135160
@@ -142,9 +167,9 @@ new Between({x: 2, y: 3, z: 4}, {x: 4, y: 6, z: 10}).time(1000)
142167 });
143168` ` `
144169
145- [Example](http://betweenjs.surge.sh /objects.html)
170+ [Example](http://between.js.org /objects.html)
146171
147- ## Looping
172+ # Looping
148173
149174Repeat ` N ` times
150175
@@ -159,7 +184,7 @@ new Between(1, 10).time(4000)
159184 });
160185` ` `
161186
162- [Example](http://betweenjs.surge.sh /loop-repeat.html)
187+ [Example](http://between.js.org /loop-repeat.html)
163188
164189Repeat endless
165190
@@ -173,7 +198,7 @@ new Between(1, 10).time(4000)
173198 });
174199` ` `
175200
176- [Example](http://betweenjs.surge.sh /loop-repeat.html)
201+ [Example](http://between.js.org /loop-repeat.html)
177202
178203Bounce ` N ` times
179204
@@ -188,9 +213,9 @@ new Between(1, 10).time(4000)
188213 });
189214` ` `
190215
191- [Example](http://betweenjs.surge.sh /loop-bounce.html)
216+ [Example](http://between.js.org /loop-bounce.html)
192217
193- ## Easing
218+ # Easing
194219
195220` ` ` javascript
196221import Between from ' between.js' ;
@@ -205,13 +230,13 @@ new Between(1, 10).time(4000)
205230 });
206231` ` `
207232
208- [Example](http://betweenjs.surge.sh /easing.html)
233+ [Example](http://between.js.org /easing.html)
209234
210235<img src=".gitbook/assets/screen-shot-2018-07-29-at-13.25.52.png" height="400">
211236
212237[easing-functions npm](https://www.npmjs.com/package/easing-functions)
213238
214- ## Color
239+ # Color
215240
216241Color types:
217242
@@ -232,7 +257,7 @@ new Between('red', 'rgb(255,40,30)').time(4000)
232257 });
233258` ` `
234259
235- [Example](http://betweenjs.surge.sh /color-plugin.html)
260+ [Example](http://between.js.org /color-plugin.html)
236261
237262Or in HTML:
238263
@@ -241,7 +266,7 @@ Or in HTML:
241266< script src= " ./path/to/dom-color.between.js" >< / script>
242267` ` `
243268
244- ## Mixed examples
269+ # Mixed examples
245270
246271` ` ` javascript
247272import Between from ' between.js' ;
0 commit comments