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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
import { PresEffect, PresEffectDirection, PresMovement } from './PresEnums';
/**
* Utilities like enums and interfaces for spring-based transitions.
*/
export const springPreviewColors = ['rgb(37, 161, 255)', 'rgb(99, 37, 255)', 'rgb(182, 37, 255)', 'rgb(255, 37, 168)'];
// the type of slide effect timing (spring-driven)
export enum SpringType {
GENTLE = 'gentle',
QUICK = 'quick',
BOUNCY = 'bouncy',
CUSTOM = 'custom',
}
// settings that control slide effect spring settings
export interface SpringSettings {
type: SpringType;
stiffness: number;
damping: number;
mass: number;
}
// Overall config
// Keeps these settings in sync with the AnimationSettings interface (used by gpt);
export enum AnimationSettingsProperties {
effect = 'effect',
direction = 'direction',
stiffness = 'stiffness',
damping = 'damping',
mass = 'mass',
}
export interface AnimationSettings {
effect: PresEffect;
direction: PresEffectDirection;
stiffness: number;
damping: number;
mass: number;
}
// Options in the movement easing dropdown
export const easeItems = [
{
text: 'Ease',
val: 'ease',
},
{
text: 'Ease In',
val: 'ease-in',
},
{
text: 'Ease Out',
val: 'ease-out',
},
{
text: 'Ease In Out',
val: 'ease-in-out',
},
{
text: 'Linear',
val: 'linear',
},
{
text: 'Custom',
val: 'custom',
},
];
// Options in the movement type dropdown
export const movementItems = [
{ text: 'None', val: PresMovement.None },
{ text: 'Center', val: PresMovement.Center },
{ text: 'Zoom', val: PresMovement.Zoom },
{ text: 'Pan', val: PresMovement.Pan },
{ text: 'Jump', val: PresMovement.Jump },
];
// Items in the slide effect dropdown
export const effectItems = Object.values(PresEffect)
.filter(v => isNaN(Number(v)))
.map(effect => ({
text: effect,
val: effect,
}));
// Maps each PresEffect to the default timing configuration
export const presEffectDefaultTimings: {
[key: string]: SpringSettings;
} = {
Expand: { type: SpringType.GENTLE, stiffness: 100, damping: 15, mass: 1 },
Bounce: {
type: SpringType.BOUNCY,
stiffness: 600,
damping: 15,
mass: 1,
},
Lightspeed: {
type: SpringType.GENTLE,
stiffness: 100,
damping: 15,
mass: 1,
},
Fade: {
type: SpringType.GENTLE,
stiffness: 100,
damping: 15,
mass: 1,
},
Flip: {
type: SpringType.GENTLE,
stiffness: 100,
damping: 15,
mass: 1,
},
Rotate: {
type: SpringType.GENTLE,
stiffness: 100,
damping: 15,
mass: 1,
},
Roll: {
type: SpringType.GENTLE,
stiffness: 100,
damping: 15,
mass: 1,
},
None: {
type: SpringType.GENTLE,
stiffness: 100,
damping: 15,
mass: 1,
},
};
// Dropdown items of timings for the effect
export const effectTimings = [
{
text: 'Gentle',
val: SpringType.GENTLE,
},
{
text: 'Quick',
val: SpringType.QUICK,
},
{
text: 'Bouncy',
val: SpringType.BOUNCY,
},
{
text: 'Custom',
val: SpringType.CUSTOM,
},
];
// Maps spring names to spring parameters
export const springMappings: {
[key: string]: { stiffness: number; damping: number; mass: number };
} = {
default: {
stiffness: 600,
damping: 15,
mass: 1,
},
gentle: {
stiffness: 100,
damping: 15,
mass: 1,
},
quick: {
stiffness: 300,
damping: 20,
mass: 1,
},
bouncy: {
stiffness: 600,
damping: 15,
mass: 1,
},
custom: {
stiffness: 100,
damping: 10,
mass: 1,
},
};
|