forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
55 lines (49 loc) · 1.25 KB
/
index.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
49
50
51
52
53
54
55
/**
* Copyright IBM Corp. 2018, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
export const fast01 = '70ms';
export const fast02 = '110ms';
export const moderate01 = '150ms';
export const moderate02 = '240ms';
export const slow01 = '400ms';
export const slow02 = '700ms';
export const unstable_tokens = [
'fast01',
'fast02',
'moderate01',
'moderate02',
'slow01',
'slow02',
];
export const easings = {
standard: {
productive: 'cubic-bezier(0.2, 0, 0.38, 0.9)',
expressive: 'cubic-bezier(0.4, 0.14, 0.3, 1)',
},
entrance: {
productive: 'cubic-bezier(0, 0, 0.38, 0.9)',
expressive: 'cubic-bezier(0, 0, 0.3, 1)',
},
exit: {
productive: 'cubic-bezier(0.2, 0, 1, 0.9)',
expressive: 'cubic-bezier(0.4, 0.14, 1, 1)',
},
};
export function motion(name, mode) {
if (!easings[name]) {
throw new Error(
`Unable to find easing \`${name}\` in our supported easings. Expected ` +
`One of: ${Object.keys(easings).join(', ')}`
);
}
const easing = easings[name];
if (!easing[mode]) {
throw new Error(
`Unable to find a mode for the easing \`${name}\` called: \`${mode}\``
);
}
return easing[mode];
}