Skip to content

Commit c9a1bd6

Browse files
committed
fix #242
1 parent df92230 commit c9a1bd6

File tree

6 files changed

+67
-32
lines changed

6 files changed

+67
-32
lines changed

.size-snapshot.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
{
22
"dist/addons.umd.js": {
3-
"bundled": 22011,
4-
"minified": 8383,
5-
"gzipped": 3030
3+
"bundled": 22111,
4+
"minified": 8438,
5+
"gzipped": 3046
66
},
77
"dist/web.umd.js": {
8-
"bundled": 92734,
9-
"minified": 37454,
10-
"gzipped": 12800
8+
"bundled": 93003,
9+
"minified": 37557,
10+
"gzipped": 12836
1111
},
1212
"dist/addons.js": {
13-
"bundled": 19464,
14-
"minified": 8939,
15-
"gzipped": 2984,
13+
"bundled": 19560,
14+
"minified": 8994,
15+
"gzipped": 2995,
1616
"treeshaked": {
1717
"rollup": {
18-
"code": 2537,
18+
"code": 2557,
1919
"import_statements": 305
2020
},
2121
"webpack": {
22-
"code": 3823
22+
"code": 3842
2323
}
2424
}
2525
},
2626
"dist/web.js": {
27-
"bundled": 86459,
28-
"minified": 41185,
29-
"gzipped": 13037,
27+
"bundled": 86714,
28+
"minified": 41379,
29+
"gzipped": 13077,
3030
"treeshaked": {
3131
"rollup": {
32-
"code": 35826,
32+
"code": 35862,
3333
"import_statements": 223
3434
},
3535
"webpack": {
36-
"code": 37264
36+
"code": 37306
3737
}
3838
}
3939
},
4040
"dist/native.js": {
41-
"bundled": 72181,
42-
"minified": 33084,
43-
"gzipped": 10273,
41+
"bundled": 72472,
42+
"minified": 33308,
43+
"gzipped": 10330,
4444
"treeshaked": {
4545
"rollup": {
46-
"code": 27286,
47-
"import_statements": 198
46+
"code": 27355,
47+
"import_statements": 234
4848
},
4949
"webpack": {
50-
"code": 28617
50+
"code": 28717
5151
}
5252
}
5353
},
5454
"dist/universal.js": {
55-
"bundled": 59640,
56-
"minified": 26548,
57-
"gzipped": 7608,
55+
"bundled": 59866,
56+
"minified": 26714,
57+
"gzipped": 7642,
5858
"treeshaked": {
5959
"rollup": {
6060
"code": 21453,
@@ -66,16 +66,16 @@
6666
}
6767
},
6868
"dist/konva.js": {
69-
"bundled": 70819,
70-
"minified": 32505,
71-
"gzipped": 10305,
69+
"bundled": 71076,
70+
"minified": 32701,
71+
"gzipped": 10347,
7272
"treeshaked": {
7373
"rollup": {
74-
"code": 27792,
74+
"code": 27830,
7575
"import_statements": 198
7676
},
7777
"webpack": {
78-
"code": 29148
78+
"code": 29186
7979
}
8080
}
8181
}

documentation/Addons.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,17 @@ route: /addons
44
order: -1
55
---
66

7+
# Addons
8+
9+
```jsx
10+
import { {
11+
TimingAnimation,
12+
OscillatorAnimation,
13+
Easing,
14+
Fade,
15+
Slug,
16+
DurationTrail,
17+
} from 'react-spring/dist/addons'
18+
```
19+
20+
You'll find varying implementations under [/dist/addons](https://github.com/drcmda/react-spring/tree/master/src/addons). For now there's a time-based animation as well common [easings](https://github.com/drcmda/react-spring/blob/master/src/addons/Easing.js), and IOS'es harmonic oscillator spring. All primitives understand the `impl` property which you can use to switch implementations.

documentation/Gotchas.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,28 @@ route: /gotchas
44
order: 0
55
---
66

7+
import { Tweet } from 'react-twitter-widgets'
8+
79
# Gotchas
810

11+
## Why are duration and easing hidden away as addons?
12+
13+
<p>
14+
<div style={{ float: "right", margin: '-10px 0px 30px 30px' }}>
15+
<Tweet tweetId='566736015188963328' options={{ conversation: 'none', width: '350' }}/>
16+
</div>
17+
<a href="https://www.youtube.com/watch?v=1tavDv5hXpo&feature=youtu.be&t=6m17s">Here's a good explanation</a> and it is worth it watching it until the first demo that starts at 9:40, there you can see how springs adapt without curves and durations.
18+
19+
In short, durations and easings are the number one reason UI animation is hard (and usually looks bad). This is why our focus is on physics first and foremost, where duration mathematically doesn't exist since springs are adaptive, or in other words, they work with energetic load and momentum instead of hardcoded values.
20+
</p>
21+
22+
<p>
23+
<img style={{ width: 340, float: 'left', margin: '10px 30px 30px 0px' }} src="https://www.wikihow.com/images/thumb/5/51/Do-Cool-Tricks-With-a-Slinky-Step-5-Version-4.jpg/aid283122-v4-728px-Do-Cool-Tricks-With-a-Slinky-Step-5-Version-4.jpg.webp" />
24+
Think of it like this, if you cause an animation and abort somewhere near the middle, a spring will fluidly move back according to the energy it spent getting there as if you would actually pull back a physical spring mid-momentum, whereas in a duration-based animation it would stop abruptly and naively move back taking the hard-coded time it would have spent getting to end-state using the same curve.
25+
26+
It can be odd in the beginning thinking of animation not in terms of time, but once you let go things will start to make sense and creating fluid interfaces will be easier than ever.
27+
</p>
28+
929
## Render props
1030

1131
Don't like the way render props wrap your code and create nested structures? By default we support both render and children, so you can create higher-order components like so:

doczrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default {
3333
'-apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif',
3434
},
3535
h1: {
36-
fontSize: '6em',
36+
fontSize: '4em',
3737
fontWeight: 800,
3838
},
3939
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-spring",
3-
"version": "5.9.0-beta.2",
3+
"version": "5.9.0-beta.3",
44
"description": "A set of spring-physics based animation primitives",
55
"main": "dist/web.cjs.js",
66
"module": "dist/web.js",

src/addons/TimingAnimation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ let TimingAnimation = class TimingAnimation extends Animation {
1818
this._to = config.to
1919
this._easing = config.easing !== undefined ? config.easing : easeInOut
2020
this._duration = config.duration !== undefined ? config.duration : 500
21+
this._delay = config.delay !== undefined ? config.delay : 0
2122
}
2223

2324
start(fromValue, onUpdate, onEnd) {

0 commit comments

Comments
 (0)