anim-3d-obj 2.0.9 → 2.0.11

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/dist/index.cjs ADDED
@@ -0,0 +1,693 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
+
28
+ // src/components/Obj.tsx
29
+
30
+ // src/keyframes.ts
31
+ function ensureStyleTag() {
32
+ let tag = document.getElementById(
33
+ "anim3d-keyframes"
34
+ );
35
+ if (!tag) {
36
+ tag = document.createElement("style");
37
+ tag.id = "anim3d-keyframes";
38
+ document.head.appendChild(tag);
39
+ }
40
+ return tag;
41
+ }
42
+ function inject(css) {
43
+ if (typeof document === "undefined") return;
44
+ const tag = ensureStyleTag();
45
+ tag.appendChild(document.createTextNode(css));
46
+ }
47
+ function builtInKeyframes(name, cfg) {
48
+ const hi = cfg.degreesHi ?? 15;
49
+ const lo = cfg.degreesLow ?? -15;
50
+ switch (name) {
51
+ case "Y360":
52
+ return `@keyframes Y360 { from { transform: rotateY(0deg) } to { transform: rotateY(360deg) } }`;
53
+ case "X360":
54
+ return `@keyframes X360 { from { transform: rotateX(0deg) } to { transform: rotateX(360deg) } }`;
55
+ case "Z360":
56
+ return `@keyframes Z360 { from { transform: rotateZ(0deg) } to { transform: rotateZ(360deg) } }`;
57
+ case "rockY":
58
+ return `@keyframes rockY { 0%{ transform: rotateY(${lo}deg) } 50%{ transform: rotateY(${hi}deg) } 100%{ transform: rotateY(${lo}deg) } }`;
59
+ case "rockX":
60
+ return `@keyframes rockX { 0%{ transform: rotateX(${lo}deg) } 50%{ transform: rotateX(${hi}deg) } 100%{ transform: rotateX(${lo}deg) } }`;
61
+ default:
62
+ return "";
63
+ }
64
+ }
65
+ function resolveAnimation(cfg) {
66
+ if (!cfg) return null;
67
+ const name = cfg.name;
68
+ const builtIn = builtInKeyframes(name, cfg);
69
+ if (builtIn) {
70
+ const marker = `/*kf-${name}*/`;
71
+ if (typeof document !== "undefined") {
72
+ const tag = ensureStyleTag();
73
+ if (!tag.innerHTML.includes(marker)) {
74
+ inject(`${builtIn}
75
+ ${marker}`);
76
+ }
77
+ }
78
+ return name;
79
+ }
80
+ return name;
81
+ }
82
+ function toAnimationShorthand(cfg) {
83
+ const name = resolveAnimation(cfg);
84
+ if (!cfg || !name) return null;
85
+ const dur = (cfg.duration ?? 10) + "s";
86
+ const delay = (cfg.delay ?? 0) + "s";
87
+ const iter = cfg.iterationCount ?? "infinite";
88
+ const dir = cfg.direction ?? "normal";
89
+ const timing = cfg.timing ?? "linear";
90
+ const fill = cfg.fillMode ?? "forwards";
91
+ const play = cfg.animationPlayState ?? "running";
92
+ return `${name} ${dur} ${timing} ${delay} ${iter} ${dir} ${fill} ${play}`;
93
+ }
94
+ function faceTransform3D(name, w, h, d) {
95
+ const hw = w / 2;
96
+ const hh = h / 2;
97
+ const hd = d / 2;
98
+ switch (name) {
99
+ case "front":
100
+ return `translate(-50%, -50%) translateZ(${hd}px)`;
101
+ case "back":
102
+ return `translate(-50%, -50%) rotateY(180deg) translateZ(${hd}px)`;
103
+ case "left":
104
+ return `translate(-50%, -50%) rotateY(-90deg) translateZ(${hw}px)`;
105
+ case "right":
106
+ return `translate(-50%, -50%) rotateY(90deg) translateZ(${hw}px)`;
107
+ case "top":
108
+ return `translate(-50%, -50%) rotateX(90deg) translateZ(${hh}px)`;
109
+ case "bottom":
110
+ return `translate(-50%, -50%) rotateX(-90deg) translateZ(${hh}px)`;
111
+ case "top_front":
112
+ return `translate(-50%, -50%) rotateX(45deg) translateZ(${hh}px)`;
113
+ case "top_rear":
114
+ return `translate(-50%, -50%) rotateX(135deg) translateZ(${hh}px)`;
115
+ case "bottom_front":
116
+ return `translate(-50%, -50%) rotateX(-45deg) translateZ(${hh}px)`;
117
+ case "bottom_rear":
118
+ return `translate(-50%, -50%) rotateX(-135deg) translateZ(${hh}px)`;
119
+ default:
120
+ return `translate(-50%, -50%) translateZ(${hd}px)`;
121
+ }
122
+ }
123
+ function faceTransformFlat(name, w, h, d) {
124
+ const total = 2 * w + 2 * d;
125
+ const half = total / 2;
126
+ let cx;
127
+ switch (name) {
128
+ case "front":
129
+ cx = w / 2;
130
+ break;
131
+ case "right":
132
+ cx = w + d / 2;
133
+ break;
134
+ case "back":
135
+ cx = w + d + w / 2;
136
+ break;
137
+ case "left":
138
+ cx = w + d + w + d / 2;
139
+ break;
140
+ case "top":
141
+ case "top_front":
142
+ case "top_rear":
143
+ cx = w / 2;
144
+ return `translate(-50%, -50%) translateX(${cx - half}px) translateY(-${h}px)`;
145
+ case "bottom":
146
+ case "bottom_front":
147
+ case "bottom_rear":
148
+ cx = w / 2;
149
+ return `translate(-50%, -50%) translateX(${cx - half}px) translateY(${h}px)`;
150
+ default:
151
+ cx = w / 2;
152
+ break;
153
+ }
154
+ return `translate(-50%, -50%) translateX(${cx - half}px)`;
155
+ }
156
+ function parseCssText(css) {
157
+ if (!css) return {};
158
+ const style = {};
159
+ css.split(";").forEach((rule) => {
160
+ const [prop, ...rest] = rule.split(":");
161
+ if (!prop || rest.length === 0) return;
162
+ const key = prop.trim().replace(/-([a-z])/g, (_, c) => c.toUpperCase());
163
+ style[key] = rest.join(":").trim();
164
+ });
165
+ return style;
166
+ }
167
+ function faceDimensions(name, w, h, d) {
168
+ switch (name) {
169
+ case "left":
170
+ case "right":
171
+ return { width: d, height: h };
172
+ case "top":
173
+ case "bottom":
174
+ case "top_front":
175
+ case "top_rear":
176
+ case "bottom_front":
177
+ case "bottom_rear":
178
+ return { width: w, height: d };
179
+ default:
180
+ return { width: w, height: h };
181
+ }
182
+ }
183
+ function faceAppearance(face, globalDef) {
184
+ const globalStyle = parseCssText(globalDef?.css);
185
+ const faceInlineStyle = parseCssText(face.css);
186
+ const style = {
187
+ ...globalStyle,
188
+ ...globalDef?.style ?? {},
189
+ ...faceInlineStyle,
190
+ ...face.style ?? {}
191
+ };
192
+ const className = ["anim3d-face", face.className].filter(Boolean).join(" ");
193
+ const body = face.body ?? globalDef?.body ?? null;
194
+ return { style, className, body };
195
+ }
196
+ var DEFAULT_FACE_NAMES = [
197
+ "front",
198
+ "back",
199
+ "left",
200
+ "right",
201
+ "top",
202
+ "bottom"
203
+ ];
204
+ var STAGGER_ORDER = [
205
+ "front",
206
+ "right",
207
+ "back",
208
+ "left",
209
+ "top",
210
+ "bottom",
211
+ "top_front",
212
+ "top_rear",
213
+ "bottom_front",
214
+ "bottom_rear"
215
+ ];
216
+ var Obj = React__namespace.memo(
217
+ ({
218
+ width = 160,
219
+ height = 160,
220
+ depth = 150,
221
+ perspective = 600,
222
+ perspectiveOrigin = "50% 50%",
223
+ faces,
224
+ global: globalDef,
225
+ anim1,
226
+ anim2,
227
+ showCenterDiv = false,
228
+ flat = false,
229
+ transitionDuration = 1,
230
+ oneAtATime = false,
231
+ remainJoined = false,
232
+ ytilt = false,
233
+ backfaceHidden = false,
234
+ chainEffects,
235
+ onChainComplete,
236
+ onChainReverseComplete,
237
+ className,
238
+ style
239
+ }) => {
240
+ const w = typeof width === "number" ? width : parseFloat(String(width));
241
+ const h = typeof height === "number" ? height : parseFloat(String(height));
242
+ const d = typeof depth === "number" ? depth : parseFloat(String(depth));
243
+ const animation1 = toAnimationShorthand(anim1) ?? void 0;
244
+ const animation2 = toAnimationShorthand(anim2) ?? void 0;
245
+ const [phase, setPhase] = React__namespace.useState(
246
+ flat ? "chained" : "folded"
247
+ );
248
+ const hasChain = Array.isArray(chainEffects) && chainEffects.length > 0;
249
+ const sideCountRef = React__namespace.useRef(0);
250
+ const chainDur = React__namespace.useMemo(() => {
251
+ if (!hasChain) return 0;
252
+ return Math.max(
253
+ 0,
254
+ ...chainEffects.map(
255
+ (e) => (e.duration ?? 0.5) + (e.delay ?? 0)
256
+ )
257
+ );
258
+ }, [chainEffects, hasChain]);
259
+ const prevFlatForChain = React__namespace.useRef(flat);
260
+ React__namespace.useEffect(() => {
261
+ if (flat === prevFlatForChain.current) return;
262
+ prevFlatForChain.current = flat;
263
+ if (flat) {
264
+ setPhase("unfolding");
265
+ } else {
266
+ if (hasChain && (phase === "chained" || phase === "chaining")) {
267
+ setPhase("unchaining");
268
+ } else {
269
+ setPhase("folding");
270
+ }
271
+ }
272
+ }, [flat]);
273
+ React__namespace.useEffect(() => {
274
+ let timer;
275
+ if (phase === "unfolding") {
276
+ const sideCount = sideCountRef.current;
277
+ const unfoldDur = oneAtATime ? transitionDuration * sideCount : transitionDuration;
278
+ timer = setTimeout(() => {
279
+ if (hasChain) {
280
+ setPhase("chaining");
281
+ } else {
282
+ setPhase("chained");
283
+ onChainComplete?.();
284
+ }
285
+ }, unfoldDur * 1e3 + 60);
286
+ }
287
+ if (phase === "chaining") {
288
+ timer = setTimeout(() => {
289
+ setPhase("chained");
290
+ onChainComplete?.();
291
+ }, chainDur * 1e3 + 60);
292
+ }
293
+ if (phase === "unchaining") {
294
+ timer = setTimeout(() => {
295
+ setPhase("folding");
296
+ }, chainDur * 1e3 + 60);
297
+ }
298
+ if (phase === "folding") {
299
+ const sideCount = sideCountRef.current;
300
+ const foldDur = oneAtATime ? transitionDuration * sideCount : transitionDuration;
301
+ timer = setTimeout(() => {
302
+ setPhase("folded");
303
+ onChainReverseComplete?.();
304
+ }, foldDur * 1e3 + 60);
305
+ }
306
+ return () => {
307
+ if (timer) clearTimeout(timer);
308
+ };
309
+ }, [
310
+ phase,
311
+ hasChain,
312
+ chainDur,
313
+ transitionDuration,
314
+ oneAtATime,
315
+ onChainComplete,
316
+ onChainReverseComplete
317
+ ]);
318
+ const isFlatNow = phase === "unfolding" || phase === "chaining" || phase === "chained" || phase === "unchaining";
319
+ const chainActive = phase === "chaining" || phase === "chained";
320
+ const chainMap = React__namespace.useMemo(() => {
321
+ const map = /* @__PURE__ */ new Map();
322
+ if (chainEffects) {
323
+ for (const e of chainEffects) {
324
+ map.set(e.faceName, e);
325
+ }
326
+ }
327
+ return map;
328
+ }, [chainEffects]);
329
+ const chainKeyframeCache = React__namespace.useRef(/* @__PURE__ */ new Map());
330
+ function getChainKeyframes(faceName, eff, baseTransform, reverse) {
331
+ const sx = eff.scaleX ?? 1;
332
+ const sy = eff.scaleY ?? 1;
333
+ const dir = reverse ? "rev" : "fwd";
334
+ const cacheKey = `${faceName}-${sx}-${sy}-${dir}-${baseTransform}`;
335
+ const cached = chainKeyframeCache.current.get(cacheKey);
336
+ if (cached) return cached;
337
+ const fromScale = reverse ? `scaleX(${sx}) scaleY(${sy})` : `scaleX(1) scaleY(1)`;
338
+ const toScale = reverse ? `scaleX(1) scaleY(1)` : `scaleX(${sx}) scaleY(${sy})`;
339
+ const name = `anim3d-chain-${faceName}-${dir}-${Date.now()}`;
340
+ let styleEl = document.getElementById("anim3d-chain-keyframes");
341
+ if (!styleEl) {
342
+ styleEl = document.createElement("style");
343
+ styleEl.id = "anim3d-chain-keyframes";
344
+ document.head.appendChild(styleEl);
345
+ }
346
+ styleEl.textContent += `
347
+ @keyframes ${name} {
348
+ from { transform: ${baseTransform} ${fromScale}; }
349
+ to { transform: ${baseTransform} ${toScale}; }
350
+ }
351
+ `;
352
+ chainKeyframeCache.current.set(cacheKey, name);
353
+ return name;
354
+ }
355
+ function chainStyle(faceName, baseTransform) {
356
+ const eff = chainMap.get(faceName);
357
+ if (!eff) return {};
358
+ const dur = eff.duration ?? 0.5;
359
+ const delay = eff.delay ?? 0;
360
+ const timing = eff.timing ?? "ease-in-out";
361
+ const styles = {};
362
+ const base = baseTransform ?? "";
363
+ const hasScale = eff.scaleX !== void 0 || eff.scaleY !== void 0;
364
+ if (hasScale) {
365
+ if (chainActive) {
366
+ const kfName = getChainKeyframes(faceName, eff, base, false);
367
+ styles.animation = `${kfName} ${dur}s ${timing} ${delay}s forwards`;
368
+ } else if (phase === "unchaining") {
369
+ const kfName = getChainKeyframes(faceName, eff, base, true);
370
+ styles.animation = `${kfName} ${dur}s ${timing} ${delay}s forwards`;
371
+ }
372
+ }
373
+ if (eff.background !== void 0) {
374
+ if (chainActive) {
375
+ styles.background = eff.background;
376
+ }
377
+ }
378
+ if (eff.opacity !== void 0) {
379
+ if (chainActive) {
380
+ styles.opacity = eff.opacity;
381
+ }
382
+ }
383
+ return styles;
384
+ }
385
+ const faceList = faces && faces.length > 0 ? faces : DEFAULT_FACE_NAMES.map((name) => ({ name }));
386
+ sideCountRef.current = faceList.filter(
387
+ (f) => ["front", "right", "back", "left"].includes(f.name)
388
+ ).length;
389
+ const bfv = backfaceHidden ? "hidden" : "visible";
390
+ const transitionCss = (delay = 0) => `transform ${transitionDuration}s ease-in-out ${delay}s`;
391
+ const tiltCount = React__namespace.useRef(0);
392
+ const prevFlat = React__namespace.useRef(flat);
393
+ const [tiltAnim, setTiltAnim] = React__namespace.useState(void 0);
394
+ React__namespace.useEffect(() => {
395
+ if (flat !== prevFlat.current) {
396
+ prevFlat.current = flat;
397
+ if (ytilt) {
398
+ tiltCount.current += 1;
399
+ const sideCount = faceList.filter(
400
+ (f) => ["front", "right", "back", "left"].includes(
401
+ f.name
402
+ )
403
+ ).length;
404
+ const totalDur = oneAtATime ? transitionDuration * sideCount : transitionDuration;
405
+ const name = tiltCount.current % 2 === 0 ? "anim3d-ytilt-a" : "anim3d-ytilt-b";
406
+ setTiltAnim(
407
+ `${name} ${totalDur}s ease-in-out 1 forwards`
408
+ );
409
+ const timer = setTimeout(
410
+ () => setTiltAnim(void 0),
411
+ totalDur * 1e3 + 50
412
+ );
413
+ return () => clearTimeout(timer);
414
+ }
415
+ }
416
+ }, [flat, ytilt, transitionDuration, oneAtATime, faceList]);
417
+ const renderStandard = () => faceList.map((face, i) => {
418
+ const dims = faceDimensions(face.name, w, h, d);
419
+ const baseTransform = isFlatNow ? faceTransformFlat(face.name, w, h, d) : faceTransform3D(face.name, w, h, d);
420
+ const {
421
+ style: fStyle,
422
+ className: fCls,
423
+ body
424
+ } = faceAppearance(face, globalDef);
425
+ const idx = STAGGER_ORDER.indexOf(face.name);
426
+ const delay = oneAtATime ? (idx >= 0 ? idx : i) * transitionDuration : 0;
427
+ const cStyle = chainStyle(face.name, baseTransform);
428
+ const foldTransition = transitionCss(delay);
429
+ return /* @__PURE__ */ jsxRuntime.jsx(
430
+ "div",
431
+ {
432
+ className: fCls,
433
+ style: {
434
+ ...fStyle,
435
+ ...cStyle,
436
+ width: dims.width,
437
+ height: dims.height,
438
+ transform: baseTransform,
439
+ transition: foldTransition,
440
+ backfaceVisibility: bfv
441
+ },
442
+ children: body
443
+ },
444
+ face.name + "-" + i
445
+ );
446
+ });
447
+ const renderJoined = () => {
448
+ const findFace = (n) => faceList.find((f) => f.name === n);
449
+ const frontFace = findFace("front");
450
+ const rightFace = findFace("right");
451
+ const backFace = findFace("back");
452
+ const leftFace = findFace("left");
453
+ const sideNames = /* @__PURE__ */ new Set([
454
+ "front",
455
+ "right",
456
+ "back",
457
+ "left"
458
+ ]);
459
+ const otherFaces = faceList.filter(
460
+ (f) => !sideNames.has(f.name)
461
+ );
462
+ const step = oneAtATime ? transitionDuration : 0;
463
+ const renderFaceEl = (face, dims, extra, key) => {
464
+ if (!face) return null;
465
+ const {
466
+ style: fStyle,
467
+ className: fCls,
468
+ body
469
+ } = faceAppearance(face, globalDef);
470
+ const baseTransform = extra.transform ?? "";
471
+ const cStyle = chainStyle(face.name, baseTransform);
472
+ const eff = chainMap.get(face.name);
473
+ const hasChainAnim = !!cStyle.animation;
474
+ let chainOrigin;
475
+ if (hasChainAnim && eff) {
476
+ const xOrigin = remainJoined && isFlatNow ? "left" : "center";
477
+ const yOrigin = eff.keepAligned ?? "center";
478
+ chainOrigin = `${xOrigin} ${yOrigin}`;
479
+ }
480
+ return /* @__PURE__ */ jsxRuntime.jsx(
481
+ "div",
482
+ {
483
+ className: fCls,
484
+ style: {
485
+ ...fStyle,
486
+ ...cStyle,
487
+ width: dims.width,
488
+ height: dims.height,
489
+ display: "flex",
490
+ alignItems: "center",
491
+ justifyContent: "center",
492
+ boxSizing: "border-box",
493
+ backfaceVisibility: bfv,
494
+ ...extra,
495
+ ...chainOrigin ? { transformOrigin: chainOrigin } : {}
496
+ },
497
+ children: body
498
+ },
499
+ key
500
+ );
501
+ };
502
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
503
+ renderFaceEl(
504
+ frontFace,
505
+ { width: w, height: h },
506
+ {
507
+ position: "absolute",
508
+ left: "50%",
509
+ top: "50%",
510
+ transform: isFlatNow ? "translate(-50%, -50%)" : `translate(-50%, -50%) translateZ(${d / 2}px)`,
511
+ transition: transitionCss(0)
512
+ },
513
+ "front-j"
514
+ ),
515
+ /* @__PURE__ */ jsxRuntime.jsxs(
516
+ "div",
517
+ {
518
+ style: {
519
+ position: "absolute",
520
+ left: `calc(50% + ${w / 2}px)`,
521
+ top: "50%",
522
+ width: 0,
523
+ height: 0,
524
+ transformOrigin: "0 0",
525
+ transformStyle: "preserve-3d",
526
+ transform: isFlatNow ? "none" : `translateZ(${d / 2}px) rotateY(90deg)`,
527
+ transition: transitionCss(step)
528
+ },
529
+ children: [
530
+ renderFaceEl(
531
+ rightFace,
532
+ { width: d, height: h },
533
+ {
534
+ position: "absolute",
535
+ left: 0,
536
+ top: 0,
537
+ transform: "translateY(-50%)"
538
+ },
539
+ "right-j"
540
+ ),
541
+ /* @__PURE__ */ jsxRuntime.jsxs(
542
+ "div",
543
+ {
544
+ style: {
545
+ position: "absolute",
546
+ left: d,
547
+ top: 0,
548
+ width: 0,
549
+ height: 0,
550
+ transformOrigin: "0 0",
551
+ transformStyle: "preserve-3d",
552
+ transform: isFlatNow ? "none" : "rotateY(90deg)",
553
+ transition: transitionCss(step * 2)
554
+ },
555
+ children: [
556
+ renderFaceEl(
557
+ backFace,
558
+ { width: w, height: h },
559
+ {
560
+ position: "absolute",
561
+ left: 0,
562
+ top: 0,
563
+ transform: "translateY(-50%)"
564
+ },
565
+ "back-j"
566
+ ),
567
+ /* @__PURE__ */ jsxRuntime.jsx(
568
+ "div",
569
+ {
570
+ style: {
571
+ position: "absolute",
572
+ left: w,
573
+ top: 0,
574
+ width: 0,
575
+ height: 0,
576
+ transformOrigin: "0 0",
577
+ transformStyle: "preserve-3d",
578
+ transform: isFlatNow ? "none" : "rotateY(90deg)",
579
+ transition: transitionCss(step * 3)
580
+ },
581
+ children: renderFaceEl(
582
+ leftFace,
583
+ { width: d, height: h },
584
+ {
585
+ position: "absolute",
586
+ left: 0,
587
+ top: 0,
588
+ transform: "translateY(-50%)"
589
+ },
590
+ "left-j"
591
+ )
592
+ }
593
+ )
594
+ ]
595
+ }
596
+ )
597
+ ]
598
+ }
599
+ ),
600
+ otherFaces.map((face, i) => {
601
+ const dims = faceDimensions(face.name, w, h, d);
602
+ const xform = isFlatNow ? faceTransformFlat(face.name, w, h, d) : faceTransform3D(face.name, w, h, d);
603
+ const {
604
+ style: fStyle,
605
+ className: fCls,
606
+ body
607
+ } = faceAppearance(face, globalDef);
608
+ return /* @__PURE__ */ jsxRuntime.jsx(
609
+ "div",
610
+ {
611
+ className: fCls,
612
+ style: {
613
+ ...fStyle,
614
+ width: dims.width,
615
+ height: dims.height,
616
+ transform: xform,
617
+ transition: transitionCss(0),
618
+ backfaceVisibility: bfv
619
+ },
620
+ children: body
621
+ },
622
+ face.name + "-o-" + i
623
+ );
624
+ })
625
+ ] });
626
+ };
627
+ const cssVars = {
628
+ "--obj-w": w + "px",
629
+ "--obj-h": h + "px",
630
+ "--obj-d": d + "px"
631
+ };
632
+ return /* @__PURE__ */ jsxRuntime.jsx(
633
+ "div",
634
+ {
635
+ className: ["anim3d-stage", className].filter(Boolean).join(" "),
636
+ style: {
637
+ perspective,
638
+ perspectiveOrigin,
639
+ ...cssVars,
640
+ ...style
641
+ },
642
+ "data-anim-3d-obj": true,
643
+ role: "img",
644
+ "aria-label": "3D object",
645
+ children: /* @__PURE__ */ jsxRuntime.jsx(
646
+ "div",
647
+ {
648
+ style: {
649
+ transformStyle: "preserve-3d",
650
+ animation: tiltAnim
651
+ },
652
+ children: /* @__PURE__ */ jsxRuntime.jsx(
653
+ "div",
654
+ {
655
+ className: "anim3d-wrapper",
656
+ style: {
657
+ ...cssVars,
658
+ animation: isFlatNow ? "none" : animation1,
659
+ transformStyle: "preserve-3d",
660
+ transition: transitionCss()
661
+ },
662
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
663
+ "div",
664
+ {
665
+ className: "anim3d-wrapper",
666
+ style: {
667
+ ...cssVars,
668
+ animation: isFlatNow ? "none" : animation2,
669
+ transformStyle: "preserve-3d",
670
+ transition: transitionCss()
671
+ },
672
+ children: [
673
+ showCenterDiv && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "anim3d-center" }),
674
+ remainJoined ? renderJoined() : renderStandard()
675
+ ]
676
+ }
677
+ )
678
+ }
679
+ )
680
+ }
681
+ )
682
+ }
683
+ );
684
+ }
685
+ );
686
+ Obj.displayName = "Obj";
687
+
688
+ exports.Obj = Obj;
689
+ exports.default = Obj;
690
+ exports.resolveAnimation = resolveAnimation;
691
+ exports.toAnimationShorthand = toAnimationShorthand;
692
+ //# sourceMappingURL=index.cjs.map
693
+ //# sourceMappingURL=index.cjs.map