-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweens.js
48 lines (46 loc) · 952 Bytes
/
tweens.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const deviceScreen = require('Dimensions').get('window')
module.exports = {
material: (ratio) => {
var drawerShadow = ratio < .2 ? ratio*5*5 : 5
return {
drawer: {
shadowRadius: drawerShadow,
},
main: {
opacity:(2-ratio)/2,
},
}
},
rotate: (ratio) => {
var r0 = -ratio/8
var r1 = 1-ratio/2
var t = [
r1, r0, 0, 0,
-r0, r1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
]
return {
main: {
transformMatrix:t,
left: ratio*300,
},
}
},
parallax: (ratio) => {
var r1 = 1
var t = [
r1, 0, 0, 0,
0, r1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
]
return {
main: {
left:deviceScreen.width*ratio/2,
transformMatrix: t,
opacity: 1-ratio*.3
},
}
},
}