@buoy-gg/floating-tools-core 2.1.4-beta.2 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/FloatingToolsStore.js +1 -501
- package/lib/commonjs/colors.js +1 -54
- package/lib/commonjs/constants.js +1 -31
- package/lib/commonjs/devToolsState.js +1 -325
- package/lib/commonjs/dial.js +1 -617
- package/lib/commonjs/easing.js +1 -69
- package/lib/commonjs/icons/benchmark-icon.js +1 -24
- package/lib/commonjs/icons/env-icon.js +1 -24
- package/lib/commonjs/icons/events-icon.js +1 -24
- package/lib/commonjs/icons/highlight-icon.js +1 -24
- package/lib/commonjs/icons/icon-data.js +1 -2268
- package/lib/commonjs/icons/icon-factories.js +1 -173
- package/lib/commonjs/icons/icon-primitives.js +1 -559
- package/lib/commonjs/icons/icon-primitives.native.js +1 -779
- package/lib/commonjs/icons/icon-renderer.js +1 -260
- package/lib/commonjs/icons/network-icon.js +1 -24
- package/lib/commonjs/icons/query-icon.js +1 -24
- package/lib/commonjs/icons/redux-icon.js +1 -85
- package/lib/commonjs/icons/renders-icon.js +1 -33
- package/lib/commonjs/icons/routes-icon.js +1 -49
- package/lib/commonjs/icons/sentry-icon.js +1 -24
- package/lib/commonjs/icons/storage-icon.js +1 -24
- package/lib/commonjs/icons/wifi-icon.js +1 -24
- package/lib/commonjs/index.js +1 -723
- package/lib/commonjs/settings.js +1 -588
- package/lib/commonjs/utils.js +1 -72
- package/lib/module/FloatingToolsStore.js +1 -496
- package/lib/module/colors.js +1 -49
- package/lib/module/constants.js +1 -27
- package/lib/module/devToolsState.js +1 -318
- package/lib/module/dial.js +1 -603
- package/lib/module/easing.js +1 -62
- package/lib/module/icons/benchmark-icon.js +1 -15
- package/lib/module/icons/env-icon.js +1 -15
- package/lib/module/icons/events-icon.js +1 -15
- package/lib/module/icons/highlight-icon.js +1 -15
- package/lib/module/icons/icon-data.js +1 -2264
- package/lib/module/icons/icon-factories.js +1 -163
- package/lib/module/icons/icon-primitives.js +1 -547
- package/lib/module/icons/icon-primitives.native.js +1 -767
- package/lib/module/icons/icon-renderer.js +1 -255
- package/lib/module/icons/network-icon.js +1 -15
- package/lib/module/icons/query-icon.js +1 -15
- package/lib/module/icons/redux-icon.js +1 -81
- package/lib/module/icons/renders-icon.js +1 -17
- package/lib/module/icons/routes-icon.js +1 -41
- package/lib/module/icons/sentry-icon.js +1 -15
- package/lib/module/icons/storage-icon.js +1 -15
- package/lib/module/icons/wifi-icon.js +1 -15
- package/lib/module/index.js +1 -103
- package/lib/module/settings.js +1 -576
- package/lib/module/utils.js +1 -66
- package/package.json +1 -1
- package/lib/typescript/commonjs/FloatingToolsStore.d.ts.map +0 -1
- package/lib/typescript/commonjs/colors.d.ts.map +0 -1
- package/lib/typescript/commonjs/constants.d.ts.map +0 -1
- package/lib/typescript/commonjs/devToolsState.d.ts.map +0 -1
- package/lib/typescript/commonjs/dial.d.ts.map +0 -1
- package/lib/typescript/commonjs/easing.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/benchmark-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/env-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/events-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/highlight-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/icon-data.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/icon-factories.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/icon-primitives.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/icon-primitives.native.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/icon-renderer.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/network-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/query-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/redux-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/renders-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/routes-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/sentry-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/storage-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/icons/wifi-icon.d.ts.map +0 -1
- package/lib/typescript/commonjs/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/settings.d.ts.map +0 -1
- package/lib/typescript/commonjs/types.d.ts.map +0 -1
- package/lib/typescript/commonjs/utils.d.ts.map +0 -1
- package/lib/typescript/module/FloatingToolsStore.d.ts.map +0 -1
- package/lib/typescript/module/colors.d.ts.map +0 -1
- package/lib/typescript/module/constants.d.ts.map +0 -1
- package/lib/typescript/module/devToolsState.d.ts.map +0 -1
- package/lib/typescript/module/dial.d.ts.map +0 -1
- package/lib/typescript/module/easing.d.ts.map +0 -1
- package/lib/typescript/module/icons/benchmark-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/env-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/events-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/highlight-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/icon-data.d.ts.map +0 -1
- package/lib/typescript/module/icons/icon-factories.d.ts.map +0 -1
- package/lib/typescript/module/icons/icon-primitives.d.ts.map +0 -1
- package/lib/typescript/module/icons/icon-primitives.native.d.ts.map +0 -1
- package/lib/typescript/module/icons/icon-renderer.d.ts.map +0 -1
- package/lib/typescript/module/icons/network-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/query-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/redux-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/renders-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/routes-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/sentry-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/storage-icon.d.ts.map +0 -1
- package/lib/typescript/module/icons/wifi-icon.d.ts.map +0 -1
- package/lib/typescript/module/index.d.ts.map +0 -1
- package/lib/typescript/module/settings.d.ts.map +0 -1
- package/lib/typescript/module/types.d.ts.map +0 -1
- package/lib/typescript/module/utils.d.ts.map +0 -1
package/lib/commonjs/dial.js
CHANGED
|
@@ -1,617 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dialStyles = exports.dialColors = exports.dialCSSBeziers = exports.dialAnimationConfig = exports.MAX_DIAL_SLOTS = exports.DIAL_START_ANGLE = exports.DIAL_ICON_SIZE = exports.DIAL_ICON_PADDING = exports.DIAL_GRID_LINE_COUNT = exports.DIAL_BUTTON_SIZE = void 0;
|
|
7
|
-
exports.generateDialCSSKeyframes = generateDialCSSKeyframes;
|
|
8
|
-
exports.getAllIconPositions = getAllIconPositions;
|
|
9
|
-
exports.getDialCSSAnimationStyles = getDialCSSAnimationStyles;
|
|
10
|
-
exports.getDialCSSKeyframesString = getDialCSSKeyframesString;
|
|
11
|
-
exports.getDialLayout = getDialLayout;
|
|
12
|
-
exports.getGridLineRotations = getGridLineRotations;
|
|
13
|
-
exports.getIconAngle = getIconAngle;
|
|
14
|
-
exports.getIconPosition = getIconPosition;
|
|
15
|
-
exports.getIconStaggerInputRange = getIconStaggerInputRange;
|
|
16
|
-
exports.getSpiralAnimationPosition = getSpiralAnimationPosition;
|
|
17
|
-
exports.getStaggeredIconProgress = getStaggeredIconProgress;
|
|
18
|
-
var _colors = require("./colors.js");
|
|
19
|
-
/**
|
|
20
|
-
* Dial Menu - Shared layout calculations, colors, and styling.
|
|
21
|
-
*
|
|
22
|
-
* Pure configuration and math functions for the dial menu.
|
|
23
|
-
* No React or platform-specific code.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
// =============================
|
|
27
|
-
// Constants
|
|
28
|
-
// =============================
|
|
29
|
-
|
|
30
|
-
/** Maximum number of slots in the dial */
|
|
31
|
-
const MAX_DIAL_SLOTS = exports.MAX_DIAL_SLOTS = 6;
|
|
32
|
-
|
|
33
|
-
/** Starting angle for first icon (top of circle, -90 degrees in radians) */
|
|
34
|
-
const DIAL_START_ANGLE = exports.DIAL_START_ANGLE = -1 * Math.PI / 2;
|
|
35
|
-
|
|
36
|
-
/** Default button size in the center */
|
|
37
|
-
const DIAL_BUTTON_SIZE = exports.DIAL_BUTTON_SIZE = 80;
|
|
38
|
-
|
|
39
|
-
/** Default icon view size */
|
|
40
|
-
const DIAL_ICON_SIZE = exports.DIAL_ICON_SIZE = 60;
|
|
41
|
-
|
|
42
|
-
/** Padding from edge of circle to icons */
|
|
43
|
-
const DIAL_ICON_PADDING = exports.DIAL_ICON_PADDING = 20;
|
|
44
|
-
|
|
45
|
-
/** Number of grid lines in the dial */
|
|
46
|
-
const DIAL_GRID_LINE_COUNT = exports.DIAL_GRID_LINE_COUNT = 6;
|
|
47
|
-
|
|
48
|
-
// =============================
|
|
49
|
-
// Dial Colors
|
|
50
|
-
// =============================
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Color palette for the dial menu.
|
|
54
|
-
* Derived from floatingToolsColors for consistency.
|
|
55
|
-
*
|
|
56
|
-
* Property names match existing mobile implementation for compatibility.
|
|
57
|
-
*/
|
|
58
|
-
const dialColors = exports.dialColors = {
|
|
59
|
-
/** Background color for the dial circle */
|
|
60
|
-
dialBackground: '#000000',
|
|
61
|
-
/** Gradient layer colors (with alpha) */
|
|
62
|
-
dialGradient1: (0, _colors.withAlpha)(_colors.floatingToolsColors.info, '10'),
|
|
63
|
-
dialGradient2: (0, _colors.withAlpha)(_colors.floatingToolsColors.info, '08'),
|
|
64
|
-
dialGradient3: (0, _colors.withAlpha)(_colors.floatingToolsColors.info, '15'),
|
|
65
|
-
/** Border color for dial and buttons */
|
|
66
|
-
dialBorder: (0, _colors.withAlpha)(_colors.floatingToolsColors.info, '40'),
|
|
67
|
-
/** Shadow/glow color */
|
|
68
|
-
dialShadow: _colors.floatingToolsColors.info,
|
|
69
|
-
/** Grid line color */
|
|
70
|
-
dialGridLine: (0, _colors.withAlpha)(_colors.floatingToolsColors.info, '26'),
|
|
71
|
-
/** Backdrop overlay color */
|
|
72
|
-
dialBackdrop: 'rgba(0, 0, 0, 0.85)',
|
|
73
|
-
/** Center button text color */
|
|
74
|
-
centerText: _colors.floatingToolsColors.secondary,
|
|
75
|
-
/** Center button text glow */
|
|
76
|
-
centerTextGlow: _colors.floatingToolsColors.info,
|
|
77
|
-
/** Icon label color */
|
|
78
|
-
iconLabel: _colors.floatingToolsColors.secondary,
|
|
79
|
-
/** Empty slot dot background */
|
|
80
|
-
emptyDotBackground: (0, _colors.withAlpha)(_colors.floatingToolsColors.muted, '15'),
|
|
81
|
-
/** Empty slot dot border */
|
|
82
|
-
emptyDotBorder: (0, _colors.withAlpha)(_colors.floatingToolsColors.muted, '50')
|
|
83
|
-
};
|
|
84
|
-
// =============================
|
|
85
|
-
// Dial Styling Configuration
|
|
86
|
-
// =============================
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Styling configuration for the dial menu.
|
|
90
|
-
* All numeric values that affect appearance.
|
|
91
|
-
*/
|
|
92
|
-
const dialStyles = exports.dialStyles = {
|
|
93
|
-
// Backdrop
|
|
94
|
-
backdrop: {
|
|
95
|
-
opacity: 0.85
|
|
96
|
-
},
|
|
97
|
-
// Main circle
|
|
98
|
-
circle: {
|
|
99
|
-
borderWidth: 1,
|
|
100
|
-
shadowOpacity: 0.5,
|
|
101
|
-
shadowRadius: 20
|
|
102
|
-
},
|
|
103
|
-
// Gradient layers (for depth effect)
|
|
104
|
-
gradientLayers: [{
|
|
105
|
-
opacity: 0.6,
|
|
106
|
-
offsetPercent: 0
|
|
107
|
-
}, {
|
|
108
|
-
opacity: 0.4,
|
|
109
|
-
offsetPercent: 30
|
|
110
|
-
}, {
|
|
111
|
-
opacity: 0.3,
|
|
112
|
-
offsetPercent: 50
|
|
113
|
-
}],
|
|
114
|
-
// Grid lines
|
|
115
|
-
grid: {
|
|
116
|
-
lineCount: 6,
|
|
117
|
-
lineHeight: 1,
|
|
118
|
-
/** Rotation angles in degrees for each line */
|
|
119
|
-
getLineRotations: () => Array.from({
|
|
120
|
-
length: 6
|
|
121
|
-
}, (_, i) => i * 60)
|
|
122
|
-
},
|
|
123
|
-
// Center button
|
|
124
|
-
centerButton: {
|
|
125
|
-
/** Button container is this multiple of button size */
|
|
126
|
-
containerRatio: 1.5,
|
|
127
|
-
/** Button border wrapper is this multiple of button size */
|
|
128
|
-
borderRatio: 1.2,
|
|
129
|
-
/** Border radius ratio */
|
|
130
|
-
borderRadiusRatio: 0.6,
|
|
131
|
-
borderWidth: 2,
|
|
132
|
-
text: {
|
|
133
|
-
fontSize: 10,
|
|
134
|
-
fontWeight: '900',
|
|
135
|
-
letterSpacing: 1,
|
|
136
|
-
fontFamily: 'monospace'
|
|
137
|
-
},
|
|
138
|
-
proText: {
|
|
139
|
-
fontSize: 8,
|
|
140
|
-
letterSpacing: 2
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
// Icon items
|
|
144
|
-
icon: {
|
|
145
|
-
/** Background gradient size as percent of icon size */
|
|
146
|
-
gradientBgSizePercent: 85,
|
|
147
|
-
gradientBgBorderRadius: 12,
|
|
148
|
-
gradientBgOpacity: 0.3,
|
|
149
|
-
/** Inner glow size as percent of icon size */
|
|
150
|
-
innerGlowSizePercent: 70,
|
|
151
|
-
innerGlowBorderRadius: 10,
|
|
152
|
-
innerGlowOpacity: 0.5,
|
|
153
|
-
label: {
|
|
154
|
-
fontSize: 8,
|
|
155
|
-
fontWeight: '900',
|
|
156
|
-
letterSpacing: 0.3,
|
|
157
|
-
fontFamily: 'monospace',
|
|
158
|
-
marginTop: 2
|
|
159
|
-
},
|
|
160
|
-
/** Icon wrapper margin bottom */
|
|
161
|
-
wrapperMarginBottom: 4
|
|
162
|
-
},
|
|
163
|
-
// Empty slot
|
|
164
|
-
emptySlot: {
|
|
165
|
-
dotSize: 12,
|
|
166
|
-
borderWidth: 1
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
// =============================
|
|
171
|
-
// Helper to generate grid line rotations
|
|
172
|
-
// =============================
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Get rotation angles for grid lines.
|
|
176
|
-
* @param count - Number of grid lines (default: 6)
|
|
177
|
-
* @returns Array of rotation angles in degrees
|
|
178
|
-
*/
|
|
179
|
-
function getGridLineRotations(count = DIAL_GRID_LINE_COUNT) {
|
|
180
|
-
return Array.from({
|
|
181
|
-
length: count
|
|
182
|
-
}, (_, i) => i * (360 / count));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// =============================
|
|
186
|
-
// Layout Calculations
|
|
187
|
-
// =============================
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Calculate dial layout dimensions based on screen size.
|
|
191
|
-
*/
|
|
192
|
-
function getDialLayout(config) {
|
|
193
|
-
const {
|
|
194
|
-
screenWidth,
|
|
195
|
-
maxCircleSize = 320,
|
|
196
|
-
circleSizeRatio = 0.75,
|
|
197
|
-
iconSize = DIAL_ICON_SIZE,
|
|
198
|
-
iconPadding = DIAL_ICON_PADDING
|
|
199
|
-
} = config;
|
|
200
|
-
const circleSize = Math.min(screenWidth * circleSizeRatio, maxCircleSize);
|
|
201
|
-
const circleRadius = circleSize / 2;
|
|
202
|
-
const iconRadius = circleRadius - iconSize / 2 - iconPadding;
|
|
203
|
-
return {
|
|
204
|
-
circleSize,
|
|
205
|
-
circleRadius,
|
|
206
|
-
iconRadius,
|
|
207
|
-
iconSize,
|
|
208
|
-
buttonSize: DIAL_BUTTON_SIZE
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// =============================
|
|
213
|
-
// Icon Position Calculations
|
|
214
|
-
// =============================
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Get the angle for an icon at a given index.
|
|
218
|
-
*
|
|
219
|
-
* @param index - Icon index (0-based)
|
|
220
|
-
* @param totalIcons - Total number of icon slots
|
|
221
|
-
* @param startAngle - Starting angle in radians (default: top of circle)
|
|
222
|
-
*/
|
|
223
|
-
function getIconAngle(index, totalIcons, startAngle = DIAL_START_ANGLE) {
|
|
224
|
-
const anglePerIcon = 2 * Math.PI / totalIcons;
|
|
225
|
-
return startAngle + anglePerIcon * index;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Get the position for an icon at a given index.
|
|
230
|
-
*
|
|
231
|
-
* @param index - Icon index (0-based)
|
|
232
|
-
* @param totalIcons - Total number of icon slots
|
|
233
|
-
* @param radius - Distance from center to icon
|
|
234
|
-
* @param startAngle - Starting angle in radians (default: top of circle)
|
|
235
|
-
*/
|
|
236
|
-
function getIconPosition(index, totalIcons, radius, startAngle = DIAL_START_ANGLE) {
|
|
237
|
-
const angle = getIconAngle(index, totalIcons, startAngle);
|
|
238
|
-
return {
|
|
239
|
-
x: radius * Math.cos(angle),
|
|
240
|
-
y: radius * Math.sin(angle),
|
|
241
|
-
angle
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Get positions for all icons in the dial.
|
|
247
|
-
*
|
|
248
|
-
* @param totalIcons - Total number of icon slots
|
|
249
|
-
* @param radius - Distance from center to icons
|
|
250
|
-
* @param startAngle - Starting angle in radians (default: top of circle)
|
|
251
|
-
*/
|
|
252
|
-
function getAllIconPositions(totalIcons, radius, startAngle = DIAL_START_ANGLE) {
|
|
253
|
-
return Array.from({
|
|
254
|
-
length: totalIcons
|
|
255
|
-
}, (_, index) => getIconPosition(index, totalIcons, radius, startAngle));
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// =============================
|
|
259
|
-
// Animation Timing
|
|
260
|
-
// =============================
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Get the interpolation input range for staggered icon animation.
|
|
264
|
-
* Used to create smooth entrance animations with stagger.
|
|
265
|
-
*
|
|
266
|
-
* @param index - Icon index (0-based)
|
|
267
|
-
* @param totalIcons - Total number of icons
|
|
268
|
-
* @param staggerRatio - Delay ratio per icon (default: 0.1)
|
|
269
|
-
*/
|
|
270
|
-
function getIconStaggerInputRange(index, totalIcons, staggerRatio = 0.1) {
|
|
271
|
-
const staggerDelay = index * staggerRatio;
|
|
272
|
-
const maxStagger = (totalIcons - 1) * staggerRatio;
|
|
273
|
-
return [0, staggerDelay, staggerDelay + (1 - maxStagger), 1];
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// =============================
|
|
277
|
-
// Comprehensive Animation Config
|
|
278
|
-
// =============================
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Easing function names used in animations.
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Spring animation configuration.
|
|
286
|
-
*/
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Comprehensive animation configuration for the dial menu.
|
|
290
|
-
* All timing, easing, and effect parameters in one place.
|
|
291
|
-
*/
|
|
292
|
-
const dialAnimationConfig = exports.dialAnimationConfig = {
|
|
293
|
-
/** Entrance animation sequence */
|
|
294
|
-
entrance: {
|
|
295
|
-
/** Backdrop fade in */
|
|
296
|
-
backdrop: {
|
|
297
|
-
duration: 400,
|
|
298
|
-
easing: 'linear'
|
|
299
|
-
},
|
|
300
|
-
/** Dial circle animations */
|
|
301
|
-
dial: {
|
|
302
|
-
/** Spring scale from 0 to 1 */
|
|
303
|
-
scale: {
|
|
304
|
-
type: 'spring',
|
|
305
|
-
damping: 15,
|
|
306
|
-
stiffness: 150,
|
|
307
|
-
mass: 1
|
|
308
|
-
},
|
|
309
|
-
/** 360 degree rotation on entrance */
|
|
310
|
-
rotation: {
|
|
311
|
-
duration: 800,
|
|
312
|
-
degrees: 360,
|
|
313
|
-
easing: 'easeOutCubic'
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
/** Center button spring scale with delay */
|
|
317
|
-
centerButton: {
|
|
318
|
-
delay: 300,
|
|
319
|
-
type: 'spring',
|
|
320
|
-
damping: 10,
|
|
321
|
-
stiffness: 200
|
|
322
|
-
},
|
|
323
|
-
/** Icons stagger entrance */
|
|
324
|
-
icons: {
|
|
325
|
-
delay: 500,
|
|
326
|
-
duration: 600,
|
|
327
|
-
easing: 'easeOutCubic'
|
|
328
|
-
},
|
|
329
|
-
/** Circuit traces fade in */
|
|
330
|
-
circuitTraces: {
|
|
331
|
-
delay: 600,
|
|
332
|
-
duration: 1000
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
/** Exit animation sequence */
|
|
336
|
-
exit: {
|
|
337
|
-
/** Icons collapse back to center */
|
|
338
|
-
icons: {
|
|
339
|
-
duration: 300,
|
|
340
|
-
easing: 'easeInCubic'
|
|
341
|
-
},
|
|
342
|
-
/** Center button scale down */
|
|
343
|
-
centerButton: {
|
|
344
|
-
duration: 200,
|
|
345
|
-
easing: 'easeInCubic'
|
|
346
|
-
},
|
|
347
|
-
/** Dial scale down */
|
|
348
|
-
dialScale: {
|
|
349
|
-
duration: 250,
|
|
350
|
-
easing: 'easeInCubic'
|
|
351
|
-
},
|
|
352
|
-
/** Backdrop fade out */
|
|
353
|
-
backdrop: {
|
|
354
|
-
duration: 200
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
/** Continuous looping effects */
|
|
358
|
-
continuous: {
|
|
359
|
-
/** Glitch effect - horizontal jitter */
|
|
360
|
-
glitch: {
|
|
361
|
-
interval: 3000,
|
|
362
|
-
offset: 2,
|
|
363
|
-
stepDuration: 50
|
|
364
|
-
},
|
|
365
|
-
/** Pulse effect - subtle scale oscillation */
|
|
366
|
-
pulse: {
|
|
367
|
-
minScale: 0.98,
|
|
368
|
-
maxScale: 1.02,
|
|
369
|
-
duration: 1000,
|
|
370
|
-
easing: 'easeInOutCubic'
|
|
371
|
-
},
|
|
372
|
-
/** Floating effect - vertical bobbing */
|
|
373
|
-
floating: {
|
|
374
|
-
minY: 0,
|
|
375
|
-
maxY: -8,
|
|
376
|
-
duration: 3000,
|
|
377
|
-
easing: 'easeInOutCubic'
|
|
378
|
-
},
|
|
379
|
-
/** Breathing effect - scale on center button */
|
|
380
|
-
breathing: {
|
|
381
|
-
minScale: 0.98,
|
|
382
|
-
maxScale: 1.05,
|
|
383
|
-
duration: 2500,
|
|
384
|
-
easing: 'easeInOutCubic'
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
/** Icon-specific animations */
|
|
388
|
-
icons: {
|
|
389
|
-
/** Stagger ratio for entrance (0-1 per icon) */
|
|
390
|
-
staggerRatio: 0.1,
|
|
391
|
-
/** Spiral effect parameters */
|
|
392
|
-
spiral: {
|
|
393
|
-
/** Start rotation in radians (2π = full rotation) */
|
|
394
|
-
startRotation: Math.PI * 2,
|
|
395
|
-
/** End rotation in radians */
|
|
396
|
-
endRotation: 0
|
|
397
|
-
},
|
|
398
|
-
/** Opacity interpolation during entrance */
|
|
399
|
-
opacity: {
|
|
400
|
-
inputRange: [0, 0.3, 1],
|
|
401
|
-
outputRange: [0, 0.3, 1]
|
|
402
|
-
},
|
|
403
|
-
/** Press in animation */
|
|
404
|
-
pressIn: {
|
|
405
|
-
scale: 0.95,
|
|
406
|
-
type: 'spring',
|
|
407
|
-
damping: 15,
|
|
408
|
-
stiffness: 400
|
|
409
|
-
},
|
|
410
|
-
/** Press out animation */
|
|
411
|
-
pressOut: {
|
|
412
|
-
scale: 1,
|
|
413
|
-
type: 'spring',
|
|
414
|
-
damping: 15,
|
|
415
|
-
stiffness: 400
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
/** User interaction animations */
|
|
419
|
-
interaction: {
|
|
420
|
-
/** Icon selection pulse effect */
|
|
421
|
-
iconSelect: {
|
|
422
|
-
pulse: [{
|
|
423
|
-
scale: 0.9,
|
|
424
|
-
damping: 15,
|
|
425
|
-
stiffness: 500
|
|
426
|
-
}, {
|
|
427
|
-
scale: 1,
|
|
428
|
-
damping: 10,
|
|
429
|
-
stiffness: 200
|
|
430
|
-
}],
|
|
431
|
-
actionDelay: 50
|
|
432
|
-
},
|
|
433
|
-
/** Center button hover effect */
|
|
434
|
-
centerHover: {
|
|
435
|
-
scale: 1.05,
|
|
436
|
-
duration: 150
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
};
|
|
440
|
-
// =============================
|
|
441
|
-
// CSS Bezier Curve Equivalents
|
|
442
|
-
// =============================
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* CSS cubic-bezier approximations for React Native springs.
|
|
446
|
-
* These provide similar visual feel in CSS transitions/animations.
|
|
447
|
-
*/
|
|
448
|
-
const dialCSSBeziers = exports.dialCSSBeziers = {
|
|
449
|
-
// Spring approximations (derived from damping/stiffness values)
|
|
450
|
-
/** Spring: damping 15, stiffness 150 (dial scale) */
|
|
451
|
-
dialScale: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
|
|
452
|
-
/** Spring: damping 10, stiffness 200 (center button) */
|
|
453
|
-
centerButton: 'cubic-bezier(0.25, 1.7, 0.55, 1)',
|
|
454
|
-
/** Spring: damping 15, stiffness 400 (icon press) */
|
|
455
|
-
iconPress: 'cubic-bezier(0.22, 1.2, 0.36, 1)',
|
|
456
|
-
/** Spring: damping 15, stiffness 500 (icon select pulse) */
|
|
457
|
-
iconSelectPulse: 'cubic-bezier(0.18, 1.15, 0.32, 1)',
|
|
458
|
-
// Standard easing curves
|
|
459
|
-
/** Decelerate - for entrance animations */
|
|
460
|
-
easeOutCubic: 'cubic-bezier(0.33, 1, 0.68, 1)',
|
|
461
|
-
/** Accelerate - for exit animations */
|
|
462
|
-
easeInCubic: 'cubic-bezier(0.32, 0, 0.67, 0)',
|
|
463
|
-
/** Smooth in-out - for continuous effects */
|
|
464
|
-
easeInOutCubic: 'cubic-bezier(0.65, 0, 0.35, 1)',
|
|
465
|
-
/** Linear */
|
|
466
|
-
linear: 'linear'
|
|
467
|
-
};
|
|
468
|
-
// =============================
|
|
469
|
-
// CSS Keyframe Generators
|
|
470
|
-
// =============================
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Generate CSS @keyframes definitions for dial animations.
|
|
474
|
-
* Can be injected into a <style> tag or used with CSS-in-JS.
|
|
475
|
-
*/
|
|
476
|
-
function generateDialCSSKeyframes() {
|
|
477
|
-
const c = dialAnimationConfig.continuous;
|
|
478
|
-
return {
|
|
479
|
-
/** Glitch effect - horizontal jitter */
|
|
480
|
-
dialGlitch: `@keyframes dialGlitch {
|
|
481
|
-
0%, 100% { transform: translateX(0); }
|
|
482
|
-
33% { transform: translateX(${c.glitch.offset}px); }
|
|
483
|
-
66% { transform: translateX(-${c.glitch.offset}px); }
|
|
484
|
-
}`,
|
|
485
|
-
/** Pulse effect - scale oscillation */
|
|
486
|
-
dialPulse: `@keyframes dialPulse {
|
|
487
|
-
0%, 100% { transform: scale(1); }
|
|
488
|
-
50% { transform: scale(${c.pulse.maxScale}); }
|
|
489
|
-
}`,
|
|
490
|
-
/** Floating effect - vertical bob */
|
|
491
|
-
dialFloating: `@keyframes dialFloating {
|
|
492
|
-
0%, 100% { transform: translateY(0); }
|
|
493
|
-
50% { transform: translateY(${c.floating.maxY}px); }
|
|
494
|
-
}`,
|
|
495
|
-
/** Breathing effect - scale pulse */
|
|
496
|
-
dialBreathing: `@keyframes dialBreathing {
|
|
497
|
-
0%, 100% { transform: scale(1); }
|
|
498
|
-
50% { transform: scale(${c.breathing.maxScale}); }
|
|
499
|
-
}`,
|
|
500
|
-
/** Dial rotation entrance */
|
|
501
|
-
dialRotation: `@keyframes dialRotation {
|
|
502
|
-
from { transform: rotate(0deg); }
|
|
503
|
-
to { transform: rotate(${dialAnimationConfig.entrance.dial.rotation.degrees}deg); }
|
|
504
|
-
}`
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Get CSS animation shorthand values for continuous effects.
|
|
510
|
-
* Use these in the `animation` CSS property.
|
|
511
|
-
*/
|
|
512
|
-
function getDialCSSAnimationStyles() {
|
|
513
|
-
const c = dialAnimationConfig.continuous;
|
|
514
|
-
return {
|
|
515
|
-
/** Glitch: triggered periodically via JS interval */
|
|
516
|
-
glitch: `dialGlitch ${c.glitch.stepDuration * 3}ms ease`,
|
|
517
|
-
/** Pulse: infinite loop */
|
|
518
|
-
pulse: `dialPulse ${c.pulse.duration * 2}ms ${dialCSSBeziers.easeInOutCubic} infinite`,
|
|
519
|
-
/** Floating: infinite loop */
|
|
520
|
-
floating: `dialFloating ${c.floating.duration * 2}ms ${dialCSSBeziers.easeInOutCubic} infinite`,
|
|
521
|
-
/** Breathing: infinite loop */
|
|
522
|
-
breathing: `dialBreathing ${c.breathing.duration * 2}ms ${dialCSSBeziers.easeInOutCubic} infinite`,
|
|
523
|
-
/** Dial rotation: plays once on entrance */
|
|
524
|
-
dialRotation: `dialRotation ${dialAnimationConfig.entrance.dial.rotation.duration}ms ${dialCSSBeziers.easeOutCubic}`
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Get all keyframes as a single CSS string for injection.
|
|
530
|
-
*/
|
|
531
|
-
function getDialCSSKeyframesString() {
|
|
532
|
-
return Object.values(generateDialCSSKeyframes()).join('\n\n');
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
// =============================
|
|
536
|
-
// Spiral Animation Utilities
|
|
537
|
-
// =============================
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Position and visual state during spiral animation.
|
|
541
|
-
*/
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Calculate icon position during spiral entrance animation.
|
|
545
|
-
*
|
|
546
|
-
* @param progress - Animation progress (0 = start at center, 1 = final position)
|
|
547
|
-
* @param index - Icon index (0-based)
|
|
548
|
-
* @param totalIcons - Total number of icons
|
|
549
|
-
* @param radius - Final radius from center
|
|
550
|
-
* @param startAngle - Starting angle for icon layout (default: top of circle)
|
|
551
|
-
*/
|
|
552
|
-
function getSpiralAnimationPosition(progress, index, totalIcons, radius, startAngle = DIAL_START_ANGLE) {
|
|
553
|
-
const finalPos = getIconPosition(index, totalIcons, radius, startAngle);
|
|
554
|
-
const spiral = dialAnimationConfig.icons.spiral;
|
|
555
|
-
const opacityConfig = dialAnimationConfig.icons.opacity;
|
|
556
|
-
|
|
557
|
-
// Clamp progress to 0-1
|
|
558
|
-
const p = Math.max(0, Math.min(1, progress));
|
|
559
|
-
|
|
560
|
-
// Spiral rotation: interpolate from startRotation to endRotation
|
|
561
|
-
const rotation = spiral.startRotation + (spiral.endRotation - spiral.startRotation) * p;
|
|
562
|
-
|
|
563
|
-
// Distance from center grows with progress
|
|
564
|
-
const distance = radius * p;
|
|
565
|
-
|
|
566
|
-
// Calculate position along spiral path
|
|
567
|
-
const spiralAngle = finalPos.angle + rotation;
|
|
568
|
-
|
|
569
|
-
// Interpolate from spiral position to final position
|
|
570
|
-
const spiralX = distance * Math.cos(spiralAngle);
|
|
571
|
-
const spiralY = distance * Math.sin(spiralAngle);
|
|
572
|
-
|
|
573
|
-
// Blend spiral position with final position based on progress
|
|
574
|
-
const x = spiralX + (finalPos.x - spiralX) * p;
|
|
575
|
-
const y = spiralY + (finalPos.y - spiralY) * p;
|
|
576
|
-
|
|
577
|
-
// Opacity interpolation with configurable curve
|
|
578
|
-
let opacity;
|
|
579
|
-
if (p <= opacityConfig.inputRange[0]) {
|
|
580
|
-
opacity = opacityConfig.outputRange[0];
|
|
581
|
-
} else if (p <= opacityConfig.inputRange[1]) {
|
|
582
|
-
const t = (p - opacityConfig.inputRange[0]) / (opacityConfig.inputRange[1] - opacityConfig.inputRange[0]);
|
|
583
|
-
opacity = opacityConfig.outputRange[0] + (opacityConfig.outputRange[1] - opacityConfig.outputRange[0]) * t;
|
|
584
|
-
} else {
|
|
585
|
-
const t = (p - opacityConfig.inputRange[1]) / (opacityConfig.inputRange[2] - opacityConfig.inputRange[1]);
|
|
586
|
-
opacity = opacityConfig.outputRange[1] + (opacityConfig.outputRange[2] - opacityConfig.outputRange[1]) * t;
|
|
587
|
-
}
|
|
588
|
-
return {
|
|
589
|
-
x,
|
|
590
|
-
y,
|
|
591
|
-
rotation,
|
|
592
|
-
scale: p,
|
|
593
|
-
opacity
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Calculate staggered progress for an icon based on master progress.
|
|
599
|
-
* Applies the stagger delay so icons animate in sequence.
|
|
600
|
-
*
|
|
601
|
-
* @param masterProgress - Overall animation progress (0-1)
|
|
602
|
-
* @param index - Icon index (0-based)
|
|
603
|
-
* @param totalIcons - Total number of icons
|
|
604
|
-
*/
|
|
605
|
-
function getStaggeredIconProgress(masterProgress, index, totalIcons) {
|
|
606
|
-
const inputRange = getIconStaggerInputRange(index, totalIcons, dialAnimationConfig.icons.staggerRatio);
|
|
607
|
-
|
|
608
|
-
// Map master progress through stagger input range
|
|
609
|
-
if (masterProgress <= inputRange[0]) return 0;
|
|
610
|
-
if (masterProgress <= inputRange[1]) return 0;
|
|
611
|
-
if (masterProgress >= inputRange[3]) return 1;
|
|
612
|
-
if (masterProgress >= inputRange[2]) return 1;
|
|
613
|
-
|
|
614
|
-
// Interpolate between inputRange[1] and inputRange[2]
|
|
615
|
-
const t = (masterProgress - inputRange[1]) / (inputRange[2] - inputRange[1]);
|
|
616
|
-
return Math.max(0, Math.min(1, t));
|
|
617
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.dialStyles=exports.dialColors=exports.dialCSSBeziers=exports.dialAnimationConfig=exports.MAX_DIAL_SLOTS=exports.DIAL_START_ANGLE=exports.DIAL_ICON_SIZE=exports.DIAL_ICON_PADDING=exports.DIAL_GRID_LINE_COUNT=exports.DIAL_BUTTON_SIZE=void 0,exports.generateDialCSSKeyframes=generateDialCSSKeyframes,exports.getAllIconPositions=getAllIconPositions,exports.getDialCSSAnimationStyles=getDialCSSAnimationStyles,exports.getDialCSSKeyframesString=getDialCSSKeyframesString,exports.getDialLayout=getDialLayout,exports.getGridLineRotations=getGridLineRotations,exports.getIconAngle=getIconAngle,exports.getIconPosition=getIconPosition,exports.getIconStaggerInputRange=getIconStaggerInputRange,exports.getSpiralAnimationPosition=getSpiralAnimationPosition,exports.getStaggeredIconProgress=getStaggeredIconProgress;var _colors=require("./colors.js");const MAX_DIAL_SLOTS=exports.MAX_DIAL_SLOTS=6,DIAL_START_ANGLE=exports.DIAL_START_ANGLE=-1*Math.PI/2,DIAL_BUTTON_SIZE=exports.DIAL_BUTTON_SIZE=80,DIAL_ICON_SIZE=exports.DIAL_ICON_SIZE=60,DIAL_ICON_PADDING=exports.DIAL_ICON_PADDING=20,DIAL_GRID_LINE_COUNT=exports.DIAL_GRID_LINE_COUNT=6,dialColors=exports.dialColors={dialBackground:"#000000",dialGradient1:(0,_colors.withAlpha)(_colors.floatingToolsColors.info,"10"),dialGradient2:(0,_colors.withAlpha)(_colors.floatingToolsColors.info,"08"),dialGradient3:(0,_colors.withAlpha)(_colors.floatingToolsColors.info,"15"),dialBorder:(0,_colors.withAlpha)(_colors.floatingToolsColors.info,"40"),dialShadow:_colors.floatingToolsColors.info,dialGridLine:(0,_colors.withAlpha)(_colors.floatingToolsColors.info,"26"),dialBackdrop:"rgba(0, 0, 0, 0.85)",centerText:_colors.floatingToolsColors.secondary,centerTextGlow:_colors.floatingToolsColors.info,iconLabel:_colors.floatingToolsColors.secondary,emptyDotBackground:(0,_colors.withAlpha)(_colors.floatingToolsColors.muted,"15"),emptyDotBorder:(0,_colors.withAlpha)(_colors.floatingToolsColors.muted,"50")},dialStyles=exports.dialStyles={backdrop:{opacity:.85},circle:{borderWidth:1,shadowOpacity:.5,shadowRadius:20},gradientLayers:[{opacity:.6,offsetPercent:0},{opacity:.4,offsetPercent:30},{opacity:.3,offsetPercent:50}],grid:{lineCount:6,lineHeight:1,getLineRotations:()=>Array.from({length:6},(t,e)=>60*e)},centerButton:{containerRatio:1.5,borderRatio:1.2,borderRadiusRatio:.6,borderWidth:2,text:{fontSize:10,fontWeight:"900",letterSpacing:1,fontFamily:"monospace"},proText:{fontSize:8,letterSpacing:2}},icon:{gradientBgSizePercent:85,gradientBgBorderRadius:12,gradientBgOpacity:.3,innerGlowSizePercent:70,innerGlowBorderRadius:10,innerGlowOpacity:.5,label:{fontSize:8,fontWeight:"900",letterSpacing:.3,fontFamily:"monospace",marginTop:2},wrapperMarginBottom:4},emptySlot:{dotSize:12,borderWidth:1}};function getGridLineRotations(t=DIAL_GRID_LINE_COUNT){return Array.from({length:t},(e,i)=>i*(360/t))}function getDialLayout(t){const{screenWidth:e,maxCircleSize:i=320,circleSizeRatio:n=.75,iconSize:o=DIAL_ICON_SIZE,iconPadding:a=DIAL_ICON_PADDING}=t,r=Math.min(e*n,i),s=r/2;return{circleSize:r,circleRadius:s,iconRadius:s-o/2-a,iconSize:o,buttonSize:DIAL_BUTTON_SIZE}}function getIconAngle(t,e,i=DIAL_START_ANGLE){return i+2*Math.PI/e*t}function getIconPosition(t,e,i,n=DIAL_START_ANGLE){const o=getIconAngle(t,e,n);return{x:i*Math.cos(o),y:i*Math.sin(o),angle:o}}function getAllIconPositions(t,e,i=DIAL_START_ANGLE){return Array.from({length:t},(n,o)=>getIconPosition(o,t,e,i))}function getIconStaggerInputRange(t,e,i=.1){const n=t*i;return[0,n,n+(1-(e-1)*i),1]}const dialAnimationConfig=exports.dialAnimationConfig={entrance:{backdrop:{duration:400,easing:"linear"},dial:{scale:{type:"spring",damping:15,stiffness:150,mass:1},rotation:{duration:800,degrees:360,easing:"easeOutCubic"}},centerButton:{delay:300,type:"spring",damping:10,stiffness:200},icons:{delay:500,duration:600,easing:"easeOutCubic"},circuitTraces:{delay:600,duration:1e3}},exit:{icons:{duration:300,easing:"easeInCubic"},centerButton:{duration:200,easing:"easeInCubic"},dialScale:{duration:250,easing:"easeInCubic"},backdrop:{duration:200}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{minScale:.98,maxScale:1.02,duration:1e3,easing:"easeInOutCubic"},floating:{minY:0,maxY:-8,duration:3e3,easing:"easeInOutCubic"},breathing:{minScale:.98,maxScale:1.05,duration:2500,easing:"easeInOutCubic"}},icons:{staggerRatio:.1,spiral:{startRotation:2*Math.PI,endRotation:0},opacity:{inputRange:[0,.3,1],outputRange:[0,.3,1]},pressIn:{scale:.95,type:"spring",damping:15,stiffness:400},pressOut:{scale:1,type:"spring",damping:15,stiffness:400}},interaction:{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50},centerHover:{scale:1.05,duration:150}}},dialCSSBeziers=exports.dialCSSBeziers={dialScale:"cubic-bezier(0.34, 1.56, 0.64, 1)",centerButton:"cubic-bezier(0.25, 1.7, 0.55, 1)",iconPress:"cubic-bezier(0.22, 1.2, 0.36, 1)",iconSelectPulse:"cubic-bezier(0.18, 1.15, 0.32, 1)",easeOutCubic:"cubic-bezier(0.33, 1, 0.68, 1)",easeInCubic:"cubic-bezier(0.32, 0, 0.67, 0)",easeInOutCubic:"cubic-bezier(0.65, 0, 0.35, 1)",linear:"linear"};function generateDialCSSKeyframes(){const t=dialAnimationConfig.continuous;return{dialGlitch:`@keyframes dialGlitch {\n 0%, 100% { transform: translateX(0); }\n 33% { transform: translateX(${t.glitch.offset}px); }\n 66% { transform: translateX(-${t.glitch.offset}px); }\n }`,dialPulse:`@keyframes dialPulse {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(${t.pulse.maxScale}); }\n }`,dialFloating:`@keyframes dialFloating {\n 0%, 100% { transform: translateY(0); }\n 50% { transform: translateY(${t.floating.maxY}px); }\n }`,dialBreathing:`@keyframes dialBreathing {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(${t.breathing.maxScale}); }\n }`,dialRotation:`@keyframes dialRotation {\n from { transform: rotate(0deg); }\n to { transform: rotate(${dialAnimationConfig.entrance.dial.rotation.degrees}deg); }\n }`}}function getDialCSSAnimationStyles(){const t=dialAnimationConfig.continuous;return{glitch:`dialGlitch ${3*t.glitch.stepDuration}ms ease`,pulse:`dialPulse ${2*t.pulse.duration}ms ${dialCSSBeziers.easeInOutCubic} infinite`,floating:`dialFloating ${2*t.floating.duration}ms ${dialCSSBeziers.easeInOutCubic} infinite`,breathing:`dialBreathing ${2*t.breathing.duration}ms ${dialCSSBeziers.easeInOutCubic} infinite`,dialRotation:`dialRotation ${dialAnimationConfig.entrance.dial.rotation.duration}ms ${dialCSSBeziers.easeOutCubic}`}}function getDialCSSKeyframesString(){return Object.values(generateDialCSSKeyframes()).join("\n\n")}function getSpiralAnimationPosition(t,e,i,n,o=DIAL_START_ANGLE){const a=getIconPosition(e,i,n,o),r=dialAnimationConfig.icons.spiral,s=dialAnimationConfig.icons.opacity,l=Math.max(0,Math.min(1,t)),c=r.startRotation+(r.endRotation-r.startRotation)*l,g=n*l,u=a.angle+c,d=g*Math.cos(u),p=g*Math.sin(u),f=d+(a.x-d)*l,S=p+(a.y-p)*l;let I;if(l<=s.inputRange[0])I=s.outputRange[0];else if(l<=s.inputRange[1]){const t=(l-s.inputRange[0])/(s.inputRange[1]-s.inputRange[0]);I=s.outputRange[0]+(s.outputRange[1]-s.outputRange[0])*t}else{const t=(l-s.inputRange[1])/(s.inputRange[2]-s.inputRange[1]);I=s.outputRange[1]+(s.outputRange[2]-s.outputRange[1])*t}return{x:f,y:S,rotation:c,scale:l,opacity:I}}function getStaggeredIconProgress(t,e,i){const n=getIconStaggerInputRange(e,i,dialAnimationConfig.icons.staggerRatio);if(t<=n[0])return 0;if(t<=n[1])return 0;if(t>=n[3])return 1;if(t>=n[2])return 1;const o=(t-n[1])/(n[2]-n[1]);return Math.max(0,Math.min(1,o))}
|
package/lib/commonjs/easing.js
CHANGED
|
@@ -1,69 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.easing = void 0;
|
|
7
|
-
exports.getEasing = getEasing;
|
|
8
|
-
exports.interpolate = interpolate;
|
|
9
|
-
exports.interpolatePosition = interpolatePosition;
|
|
10
|
-
/**
|
|
11
|
-
* Animation easing functions.
|
|
12
|
-
* Platform-agnostic - used by both web (RAF) and mobile (Animated).
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Easing functions for animations.
|
|
17
|
-
* All functions take progress (0-1) and return eased value (0-1).
|
|
18
|
-
*/
|
|
19
|
-
const easing = exports.easing = {
|
|
20
|
-
/**
|
|
21
|
-
* Linear - no easing.
|
|
22
|
-
*/
|
|
23
|
-
linear: t => t,
|
|
24
|
-
/**
|
|
25
|
-
* Ease out cubic - decelerates towards end.
|
|
26
|
-
* Used for hide/show animations.
|
|
27
|
-
*/
|
|
28
|
-
easeOutCubic: t => 1 - Math.pow(1 - t, 3),
|
|
29
|
-
/**
|
|
30
|
-
* Ease in cubic - accelerates from start.
|
|
31
|
-
*/
|
|
32
|
-
easeInCubic: t => t * t * t,
|
|
33
|
-
/**
|
|
34
|
-
* Ease in-out cubic - smooth acceleration and deceleration.
|
|
35
|
-
*/
|
|
36
|
-
easeInOutCubic: t => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2,
|
|
37
|
-
/**
|
|
38
|
-
* Ease out quad - lighter deceleration than cubic.
|
|
39
|
-
*/
|
|
40
|
-
easeOutQuad: t => 1 - (1 - t) * (1 - t),
|
|
41
|
-
/**
|
|
42
|
-
* Ease out expo - strong deceleration (snappy feel).
|
|
43
|
-
*/
|
|
44
|
-
easeOutExpo: t => t === 1 ? 1 : 1 - Math.pow(2, -10 * t)
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Get an easing function by name.
|
|
48
|
-
*/
|
|
49
|
-
function getEasing(name) {
|
|
50
|
-
return easing[name];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Interpolate between two values using an easing function.
|
|
55
|
-
*/
|
|
56
|
-
function interpolate(from, to, progress, easingFn = easing.easeOutCubic) {
|
|
57
|
-
const eased = easingFn(Math.max(0, Math.min(1, progress)));
|
|
58
|
-
return from + (to - from) * eased;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Interpolate a position (x, y) using an easing function.
|
|
63
|
-
*/
|
|
64
|
-
function interpolatePosition(from, to, progress, easingFn = easing.easeOutCubic) {
|
|
65
|
-
return {
|
|
66
|
-
x: interpolate(from.x, to.x, progress, easingFn),
|
|
67
|
-
y: interpolate(from.y, to.y, progress, easingFn)
|
|
68
|
-
};
|
|
69
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.easing=void 0,exports.getEasing=getEasing,exports.interpolate=interpolate,exports.interpolatePosition=interpolatePosition;const easing=exports.easing={linear:e=>e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInCubic:e=>e*e*e,easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeOutQuad:e=>1-(1-e)*(1-e),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e)};function getEasing(e){return easing[e]}function interpolate(e,t,i,n=easing.easeOutCubic){return e+(t-e)*n(Math.max(0,Math.min(1,i)))}function interpolatePosition(e,t,i,n=easing.easeOutCubic){return{x:interpolate(e.x,t.x,i,n),y:interpolate(e.y,t.y,i,n)}}
|