@readdy/anim 0.0.21
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/animations/button/3d-flip/index.js +60 -0
- package/animations/button/3d-flip/react.tsx +29 -0
- package/animations/button/3d-flip/style.css +17 -0
- package/animations/button/blur-fade-in/index.js +21 -0
- package/animations/button/blur-fade-in/react.tsx +26 -0
- package/animations/button/blur-fade-in/style.css +27 -0
- package/animations/button/border-beam/index.js +172 -0
- package/animations/button/border-beam/react.tsx +55 -0
- package/animations/button/border-beam/style.css +59 -0
- package/animations/button/bounce-elastic/index.js +21 -0
- package/animations/button/bounce-elastic/react.tsx +26 -0
- package/animations/button/bounce-elastic/style.css +31 -0
- package/animations/button/bubble-button/index.js +317 -0
- package/animations/button/bubble-button/react.tsx +19 -0
- package/animations/button/bubble-button/style.css +245 -0
- package/animations/button/confetti-button/index.js +66 -0
- package/animations/button/confetti-button/react.tsx +30 -0
- package/animations/button/confetti-button/style.css +48 -0
- package/animations/button/glow-cta/index.js +69 -0
- package/animations/button/glow-cta/react.tsx +45 -0
- package/animations/button/glow-cta/style.css +78 -0
- package/animations/button/magnetic-hover/index.js +61 -0
- package/animations/button/magnetic-hover/react.tsx +29 -0
- package/animations/button/magnetic-hover/style.css +18 -0
- package/animations/button/pulse/index.js +21 -0
- package/animations/button/pulse/react.tsx +26 -0
- package/animations/button/pulse/style.css +24 -0
- package/animations/button/rainbow-button/index.js +21 -0
- package/animations/button/rainbow-button/react.tsx +26 -0
- package/animations/button/rainbow-button/style.css +54 -0
- package/animations/button/shimmer-border/index.js +28 -0
- package/animations/button/shimmer-border/react.tsx +41 -0
- package/animations/button/shimmer-border/style.css +53 -0
- package/animations/button/sketch-button/index.js +16 -0
- package/animations/button/sketch-button/react.tsx +19 -0
- package/animations/button/sketch-button/style.css +25 -0
- package/animations/card/blur-rise/index.js +21 -0
- package/animations/card/blur-rise/react.tsx +26 -0
- package/animations/card/blur-rise/style.css +27 -0
- package/animations/card/bounce-in-bottom/index.js +21 -0
- package/animations/card/bounce-in-bottom/react.tsx +26 -0
- package/animations/card/bounce-in-bottom/style.css +31 -0
- package/animations/card/card-fan-spread/index.js +146 -0
- package/animations/card/card-fan-spread/react.tsx +35 -0
- package/animations/card/card-fan-spread/style.css +90 -0
- package/animations/card/card-flip/index.js +203 -0
- package/animations/card/card-flip/react.tsx +35 -0
- package/animations/card/card-flip/style.css +71 -0
- package/animations/card/float-idle/index.js +21 -0
- package/animations/card/float-idle/react.tsx +26 -0
- package/animations/card/float-idle/style.css +21 -0
- package/animations/card/image-magnifier/index.js +333 -0
- package/animations/card/image-magnifier/react.tsx +31 -0
- package/animations/card/image-magnifier/style.css +42 -0
- package/animations/card/image-zoom-rotate/index.js +48 -0
- package/animations/card/image-zoom-rotate/react.tsx +31 -0
- package/animations/card/image-zoom-rotate/style.css +20 -0
- package/animations/card/pop-in-stack/index.js +25 -0
- package/animations/card/pop-in-stack/react.tsx +33 -0
- package/animations/card/pop-in-stack/style.css +25 -0
- package/animations/card/reveal-from-top/index.js +21 -0
- package/animations/card/reveal-from-top/react.tsx +26 -0
- package/animations/card/reveal-from-top/style.css +28 -0
- package/animations/card/rgb-split-glitch/index.js +28 -0
- package/animations/card/rgb-split-glitch/react.tsx +41 -0
- package/animations/card/rgb-split-glitch/style.css +33 -0
- package/animations/card/tilted-card/index.js +64 -0
- package/animations/card/tilted-card/react.tsx +33 -0
- package/animations/card/tilted-card/style.css +27 -0
- package/animations/header/anime-splittext/index.js +108 -0
- package/animations/header/anime-splittext/react.tsx +30 -0
- package/animations/header/anime-splittext/style.css +71 -0
- package/animations/header/bounce-in-down/index.js +40 -0
- package/animations/header/bounce-in-down/react.tsx +29 -0
- package/animations/header/bounce-in-down/style.css +40 -0
- package/animations/header/fly-in-chars/index.js +46 -0
- package/animations/header/fly-in-chars/react.tsx +30 -0
- package/animations/header/fly-in-chars/style.css +29 -0
- package/animations/header/gradient-text/index.js +21 -0
- package/animations/header/gradient-text/react.tsx +26 -0
- package/animations/header/gradient-text/style.css +28 -0
- package/animations/header/letter-bounce/index.js +33 -0
- package/animations/header/letter-bounce/react.tsx +34 -0
- package/animations/header/letter-bounce/style.css +25 -0
- package/animations/header/roll-in/index.js +40 -0
- package/animations/header/roll-in/react.tsx +29 -0
- package/animations/header/roll-in/style.css +31 -0
- package/animations/header/shimmer-text/index.js +16 -0
- package/animations/header/shimmer-text/react.tsx +28 -0
- package/animations/header/shimmer-text/style.css +29 -0
- package/animations/header/shuffle/index.js +118 -0
- package/animations/header/shuffle/react.tsx +50 -0
- package/animations/header/shuffle/style.css +25 -0
- package/animations/header/split-text/index.js +72 -0
- package/animations/header/split-text/react.tsx +38 -0
- package/animations/header/split-text/style.css +31 -0
- package/animations/header/text-type/index.js +267 -0
- package/animations/header/text-type/react.tsx +63 -0
- package/animations/header/text-type/style.css +37 -0
- package/animations/header/word-curtain-reveal/index.js +97 -0
- package/animations/header/word-curtain-reveal/react.tsx +30 -0
- package/animations/header/word-curtain-reveal/style.css +39 -0
- package/dist/button/3d-flip/react.js +21 -0
- package/dist/button/3d-flip.js +61 -0
- package/dist/button/blur-fade-in/react.js +28 -0
- package/dist/button/blur-fade-in.js +17 -0
- package/dist/button/border-beam/react.js +22 -0
- package/dist/button/border-beam.js +168 -0
- package/dist/button/bounce-elastic/react.js +28 -0
- package/dist/button/bounce-elastic.js +17 -0
- package/dist/button/bubble-button/react.js +20 -0
- package/dist/button/bubble-button.js +318 -0
- package/dist/button/confetti-button/react.js +21 -0
- package/dist/button/confetti-button.js +67 -0
- package/dist/button/glow-cta/react.js +23 -0
- package/dist/button/glow-cta.js +65 -0
- package/dist/button/magnetic-hover/react.js +21 -0
- package/dist/button/magnetic-hover.js +62 -0
- package/dist/button/pulse/react.js +28 -0
- package/dist/button/pulse.js +17 -0
- package/dist/button/rainbow-button/react.js +28 -0
- package/dist/button/rainbow-button.js +17 -0
- package/dist/button/shimmer-border/react.js +22 -0
- package/dist/button/shimmer-border.js +24 -0
- package/dist/button/sketch-button/react.js +20 -0
- package/dist/button/sketch-button.js +17 -0
- package/dist/card/blur-rise/react.js +28 -0
- package/dist/card/blur-rise.js +17 -0
- package/dist/card/bounce-in-bottom/react.js +28 -0
- package/dist/card/bounce-in-bottom.js +17 -0
- package/dist/card/card-fan-spread/react.js +20 -0
- package/dist/card/card-fan-spread.js +147 -0
- package/dist/card/float-idle/react.js +28 -0
- package/dist/card/float-idle.js +17 -0
- package/dist/card/image-magnifier/react.js +22 -0
- package/dist/card/image-magnifier.js +334 -0
- package/dist/card/image-zoom-rotate/react.js +21 -0
- package/dist/card/image-zoom-rotate.js +49 -0
- package/dist/card/pop-in-stack/react.js +20 -0
- package/dist/card/pop-in-stack.js +26 -0
- package/dist/card/reveal-from-top/react.js +28 -0
- package/dist/card/reveal-from-top.js +17 -0
- package/dist/card/rgb-split-glitch/react.js +22 -0
- package/dist/card/rgb-split-glitch.js +24 -0
- package/dist/card/tilted-card/react.js +21 -0
- package/dist/card/tilted-card.js +65 -0
- package/dist/chunks/constants-EnH6-Pz4.js +66 -0
- package/dist/chunks/constants-ZTHic1pf.js +66 -0
- package/dist/chunks/pointer-follow-B3RFnn_q.js +93 -0
- package/dist/chunks/pointer-follow-BETANySn.js +93 -0
- package/dist/chunks/reduced-motion-BpQYuEzK.js +17 -0
- package/dist/chunks/reduced-motion-HX79Ac8G.js +17 -0
- package/dist/chunks/resolve-card-media-Cj3V_oms.js +43 -0
- package/dist/chunks/resolve-card-media-DBIU-duL.js +43 -0
- package/dist/chunks/text-split-D02jltVh.js +191 -0
- package/dist/chunks/text-split-frOR4UpH.js +191 -0
- package/dist/full.css +1 -0
- package/dist/full.js +3192 -0
- package/dist/header/anime-splittext/react.js +22 -0
- package/dist/header/anime-splittext.js +109 -0
- package/dist/header/bounce-in-down/react.js +32 -0
- package/dist/header/bounce-in-down.js +36 -0
- package/dist/header/fly-in-chars/react.js +23 -0
- package/dist/header/fly-in-chars.js +47 -0
- package/dist/header/gradient-text/react.js +28 -0
- package/dist/header/gradient-text.js +17 -0
- package/dist/header/letter-bounce/react.js +23 -0
- package/dist/header/letter-bounce.js +34 -0
- package/dist/header/roll-in/react.js +32 -0
- package/dist/header/roll-in.js +36 -0
- package/dist/header/shimmer-text/react.js +27 -0
- package/dist/header/shimmer-text.js +17 -0
- package/dist/header/shuffle/react.js +30 -0
- package/dist/header/shuffle.js +119 -0
- package/dist/header/split-text/react.js +26 -0
- package/dist/header/split-text.js +73 -0
- package/dist/header/text-type/react.js +43 -0
- package/dist/header/text-type.js +268 -0
- package/dist/header/word-curtain-reveal/react.js +22 -0
- package/dist/header/word-curtain-reveal.js +98 -0
- package/dist/meta.json +6 -0
- package/dist/metadata.json +1051 -0
- package/dist/react.css +1 -0
- package/dist/types/animations/button/3d-flip/index.d.ts +3 -0
- package/dist/types/animations/button/3d-flip/react.d.ts +8 -0
- package/dist/types/animations/button/blur-fade-in/index.d.ts +3 -0
- package/dist/types/animations/button/blur-fade-in/react.d.ts +13 -0
- package/dist/types/animations/button/border-beam/index.d.ts +3 -0
- package/dist/types/animations/button/border-beam/react.d.ts +25 -0
- package/dist/types/animations/button/bounce-elastic/index.d.ts +3 -0
- package/dist/types/animations/button/bounce-elastic/react.d.ts +13 -0
- package/dist/types/animations/button/bubble-button/index.d.ts +3 -0
- package/dist/types/animations/button/bubble-button/react.d.ts +4 -0
- package/dist/types/animations/button/confetti-button/index.d.ts +3 -0
- package/dist/types/animations/button/confetti-button/react.d.ts +8 -0
- package/dist/types/animations/button/glow-cta/index.d.ts +3 -0
- package/dist/types/animations/button/glow-cta/react.d.ts +20 -0
- package/dist/types/animations/button/magnetic-hover/index.d.ts +3 -0
- package/dist/types/animations/button/magnetic-hover/react.d.ts +8 -0
- package/dist/types/animations/button/pulse/index.d.ts +3 -0
- package/dist/types/animations/button/pulse/react.d.ts +13 -0
- package/dist/types/animations/button/rainbow-button/index.d.ts +3 -0
- package/dist/types/animations/button/rainbow-button/react.d.ts +13 -0
- package/dist/types/animations/button/shimmer-border/index.d.ts +3 -0
- package/dist/types/animations/button/shimmer-border/react.d.ts +18 -0
- package/dist/types/animations/button/sketch-button/index.d.ts +3 -0
- package/dist/types/animations/button/sketch-button/react.d.ts +4 -0
- package/dist/types/animations/card/blur-rise/index.d.ts +3 -0
- package/dist/types/animations/card/blur-rise/react.d.ts +13 -0
- package/dist/types/animations/card/bounce-in-bottom/index.d.ts +3 -0
- package/dist/types/animations/card/bounce-in-bottom/react.d.ts +13 -0
- package/dist/types/animations/card/card-fan-spread/index.d.ts +3 -0
- package/dist/types/animations/card/card-fan-spread/react.d.ts +11 -0
- package/dist/types/animations/card/card-flip/index.d.ts +3 -0
- package/dist/types/animations/card/card-flip/react.d.ts +11 -0
- package/dist/types/animations/card/float-idle/index.d.ts +3 -0
- package/dist/types/animations/card/float-idle/react.d.ts +13 -0
- package/dist/types/animations/card/image-magnifier/index.d.ts +3 -0
- package/dist/types/animations/card/image-magnifier/react.d.ts +9 -0
- package/dist/types/animations/card/image-zoom-rotate/index.d.ts +3 -0
- package/dist/types/animations/card/image-zoom-rotate/react.d.ts +9 -0
- package/dist/types/animations/card/pop-in-stack/index.d.ts +3 -0
- package/dist/types/animations/card/pop-in-stack/react.d.ts +10 -0
- package/dist/types/animations/card/reveal-from-top/index.d.ts +3 -0
- package/dist/types/animations/card/reveal-from-top/react.d.ts +13 -0
- package/dist/types/animations/card/rgb-split-glitch/index.d.ts +3 -0
- package/dist/types/animations/card/rgb-split-glitch/react.d.ts +18 -0
- package/dist/types/animations/card/tilted-card/index.d.ts +3 -0
- package/dist/types/animations/card/tilted-card/react.d.ts +10 -0
- package/dist/types/animations/header/anime-splittext/index.d.ts +3 -0
- package/dist/types/animations/header/anime-splittext/react.d.ts +8 -0
- package/dist/types/animations/header/bounce-in-down/index.d.ts +3 -0
- package/dist/types/animations/header/bounce-in-down/react.d.ts +13 -0
- package/dist/types/animations/header/fly-in-chars/index.d.ts +3 -0
- package/dist/types/animations/header/fly-in-chars/react.d.ts +8 -0
- package/dist/types/animations/header/gradient-text/index.d.ts +3 -0
- package/dist/types/animations/header/gradient-text/react.d.ts +13 -0
- package/dist/types/animations/header/letter-bounce/index.d.ts +3 -0
- package/dist/types/animations/header/letter-bounce/react.d.ts +10 -0
- package/dist/types/animations/header/roll-in/index.d.ts +3 -0
- package/dist/types/animations/header/roll-in/react.d.ts +13 -0
- package/dist/types/animations/header/shimmer-text/index.d.ts +3 -0
- package/dist/types/animations/header/shimmer-text/react.d.ts +4 -0
- package/dist/types/animations/header/shuffle/index.d.ts +3 -0
- package/dist/types/animations/header/shuffle/react.d.ts +14 -0
- package/dist/types/animations/header/split-text/index.d.ts +3 -0
- package/dist/types/animations/header/split-text/react.d.ts +10 -0
- package/dist/types/animations/header/text-type/index.d.ts +3 -0
- package/dist/types/animations/header/text-type/react.d.ts +13 -0
- package/dist/types/animations/header/word-curtain-reveal/index.d.ts +3 -0
- package/dist/types/animations/header/word-curtain-reveal/react.d.ts +8 -0
- package/dist/types/react-barrel.d.ts +34 -0
- package/dist/types/scripts/bundle-all.d.ts +173 -0
- package/dist/types/scripts/check-metadata.d.ts +1 -0
- package/dist/types/scripts/copy-metadata.d.ts +1 -0
- package/dist/types/scripts/generate-animation-id-map.d.ts +1 -0
- package/dist/types/scripts/generate-dist-meta.d.ts +1 -0
- package/dist/types/scripts/generate-preview-manifest.d.ts +1 -0
- package/dist/types/scripts/update-metadata.d.ts +1 -0
- package/dist/types/shared/constants.d.ts +34 -0
- package/dist/types/shared/meta.d.ts +18 -0
- package/dist/types/shared/pointer-follow.d.ts +8 -0
- package/dist/types/shared/reduced-motion.d.ts +11 -0
- package/dist/types/shared/resolve-card-media.d.ts +1 -0
- package/dist/types/shared/text-split.d.ts +19 -0
- package/dist/types/stories/3d-flip.stories.d.ts +7 -0
- package/dist/types/stories/_helpers.d.ts +24 -0
- package/dist/types/stories/anime-splittext.stories.d.ts +8 -0
- package/dist/types/stories/blur-fade-in.stories.d.ts +8 -0
- package/dist/types/stories/blur-rise.stories.d.ts +8 -0
- package/dist/types/stories/blur-to-sharp-rise-header.stories.d.ts +8 -0
- package/dist/types/stories/border-beam.stories.d.ts +8 -0
- package/dist/types/stories/bounce-elastic.stories.d.ts +8 -0
- package/dist/types/stories/bounce-in-bottom.stories.d.ts +8 -0
- package/dist/types/stories/bounce-in-down.stories.d.ts +9 -0
- package/dist/types/stories/bubble-button.stories.d.ts +8 -0
- package/dist/types/stories/card-fan-spread.stories.d.ts +7 -0
- package/dist/types/stories/card-flip.stories.d.ts +7 -0
- package/dist/types/stories/confetti-button.stories.d.ts +7 -0
- package/dist/types/stories/float-idle.stories.d.ts +8 -0
- package/dist/types/stories/fly-in-chars.stories.d.ts +8 -0
- package/dist/types/stories/glow-cta.stories.d.ts +9 -0
- package/dist/types/stories/gradient-text.stories.d.ts +9 -0
- package/dist/types/stories/image-magnifier.stories.d.ts +10 -0
- package/dist/types/stories/image-zoom-rotate.stories.d.ts +7 -0
- package/dist/types/stories/letter-bounce.stories.d.ts +8 -0
- package/dist/types/stories/magic-ui-border-beam-card.stories.d.ts +8 -0
- package/dist/types/stories/magnetic-hover.stories.d.ts +7 -0
- package/dist/types/stories/pop-in-stack.stories.d.ts +7 -0
- package/dist/types/stories/pulse.stories.d.ts +8 -0
- package/dist/types/stories/rainbow-button.stories.d.ts +8 -0
- package/dist/types/stories/reveal-from-top.stories.d.ts +8 -0
- package/dist/types/stories/rgb-split-glitch.stories.d.ts +8 -0
- package/dist/types/stories/roll-in.stories.d.ts +9 -0
- package/dist/types/stories/shimmer-border.stories.d.ts +9 -0
- package/dist/types/stories/shimmer-text.stories.d.ts +8 -0
- package/dist/types/stories/shuffle.stories.d.ts +8 -0
- package/dist/types/stories/sketch-button.stories.d.ts +7 -0
- package/dist/types/stories/split-text.stories.d.ts +8 -0
- package/dist/types/stories/text-type.stories.d.ts +8 -0
- package/dist/types/stories/tilted-card.stories.d.ts +7 -0
- package/dist/types/stories/word-curtain-reveal.stories.d.ts +8 -0
- package/package.json +166 -0
- package/react-barrel.js +44 -0
- package/shared/constants.js +64 -0
- package/shared/meta.js +21 -0
- package/shared/pointer-follow.js +91 -0
- package/shared/reduced-motion.js +15 -0
- package/shared/resolve-card-media.js +41 -0
- package/shared/text-split.js +188 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../confetti-button.js';
|
|
3
|
+
import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
|
|
4
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
5
|
+
|
|
6
|
+
function AnimConfettiButton({ children, pieces, colors, }) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
const colorsKey = colors?.join('\u0001') ?? '';
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el || prefersReducedMotion())
|
|
12
|
+
return;
|
|
13
|
+
init(el, { pieces, colors });
|
|
14
|
+
return () => {
|
|
15
|
+
destroy(el);
|
|
16
|
+
};
|
|
17
|
+
}, [colorsKey, pieces]);
|
|
18
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { AnimConfettiButton };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { p as prefersReducedMotion } from '../chunks/reduced-motion-HX79Ac8G.js';
|
|
2
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
3
|
+
|
|
4
|
+
const ANIMATION_ID = buildAnimId('confetti-button');
|
|
5
|
+
|
|
6
|
+
const CSS_CLASS = buildAnimClass('confetti-button');
|
|
7
|
+
const LAYER_CLASS = buildAnimClass('confetti-layer');
|
|
8
|
+
const PIECE_CLASS = buildAnimClass('confetti-piece');
|
|
9
|
+
const stateMap = new WeakMap();
|
|
10
|
+
|
|
11
|
+
function createBurst(el, options) {
|
|
12
|
+
const layer = document.createElement('span');
|
|
13
|
+
layer.className = LAYER_CLASS;
|
|
14
|
+
el.appendChild(layer);
|
|
15
|
+
|
|
16
|
+
const colors = options.colors ?? ['#22d3ee', '#a78bfa', '#f472b6', '#facc15', '#34d399'];
|
|
17
|
+
const pieces = options.pieces ?? 18;
|
|
18
|
+
|
|
19
|
+
for (let index = 0; index < pieces; index += 1) {
|
|
20
|
+
const piece = document.createElement('span');
|
|
21
|
+
piece.className = PIECE_CLASS;
|
|
22
|
+
piece.style.setProperty('--readdy-anim-confetti-x', `${(Math.random() - 0.5) * 180}px`);
|
|
23
|
+
piece.style.setProperty('--readdy-anim-confetti-y', `${ -40 - Math.random() * 90}px`);
|
|
24
|
+
piece.style.setProperty('--readdy-anim-confetti-rotate', `${Math.random() * 360}deg`);
|
|
25
|
+
piece.style.setProperty('--readdy-anim-confetti-delay', `${index * 14}ms`);
|
|
26
|
+
piece.style.background = colors[index % colors.length];
|
|
27
|
+
layer.appendChild(piece);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return window.setTimeout(() => {
|
|
31
|
+
layer.remove();
|
|
32
|
+
}, 1100)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function init(el, options = {}) {
|
|
36
|
+
destroy(el);
|
|
37
|
+
|
|
38
|
+
el.classList.add(CSS_CLASS);
|
|
39
|
+
|
|
40
|
+
const onClick = () => {
|
|
41
|
+
if (prefersReducedMotion()) {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
const timeoutId = createBurst(el, options);
|
|
45
|
+
const state = stateMap.get(el);
|
|
46
|
+
if (state) {
|
|
47
|
+
state.timeoutIds.push(timeoutId);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
el.addEventListener('click', onClick);
|
|
52
|
+
stateMap.set(el, { onClick, timeoutIds: [] });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function destroy(el) {
|
|
56
|
+
const state = stateMap.get(el);
|
|
57
|
+
if (state) {
|
|
58
|
+
el.removeEventListener('click', state.onClick);
|
|
59
|
+
state.timeoutIds.forEach((timeoutId) => window.clearTimeout(timeoutId));
|
|
60
|
+
stateMap.delete(el);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
el.classList.remove(CSS_CLASS);
|
|
64
|
+
el.querySelectorAll(`.${LAYER_CLASS}`).forEach((node) => node.remove());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../glow-cta.js';
|
|
3
|
+
import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
|
|
4
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
5
|
+
import '../../chunks/pointer-follow-BETANySn.js';
|
|
6
|
+
|
|
7
|
+
function AnimGlowCta({ children, scale, arrowPadding, idleOpacity, activeOpacity, inset, }) {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el)
|
|
12
|
+
return;
|
|
13
|
+
if (prefersReducedMotion())
|
|
14
|
+
return;
|
|
15
|
+
init(el, { scale, arrowPadding, idleOpacity, activeOpacity, inset });
|
|
16
|
+
return () => {
|
|
17
|
+
destroy(el);
|
|
18
|
+
};
|
|
19
|
+
}, [scale, arrowPadding, idleOpacity, activeOpacity, inset]);
|
|
20
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { AnimGlowCta };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
2
|
+
import { p as prefersReducedMotion } from '../chunks/reduced-motion-HX79Ac8G.js';
|
|
3
|
+
import { a as attachPointerFollow } from '../chunks/pointer-follow-BETANySn.js';
|
|
4
|
+
|
|
5
|
+
const ANIMATION_ID = buildAnimId('glow-cta');
|
|
6
|
+
|
|
7
|
+
const CSS_CLASS = buildAnimClass('glow-cta');
|
|
8
|
+
const ACTIVE_CLASS = buildAnimClass('glow-cta-active');
|
|
9
|
+
const cleanups = new WeakMap();
|
|
10
|
+
const GLOW_X_VAR = '--readdy-anim-glow-cta-x';
|
|
11
|
+
const GLOW_Y_VAR = '--readdy-anim-glow-cta-y';
|
|
12
|
+
|
|
13
|
+
function init(el, options = {}) {
|
|
14
|
+
if (cleanups.has(el)) return
|
|
15
|
+
|
|
16
|
+
el.classList.add(CSS_CLASS);
|
|
17
|
+
el.style.setProperty(GLOW_X_VAR, '50%');
|
|
18
|
+
el.style.setProperty(GLOW_Y_VAR, '50%');
|
|
19
|
+
el.style.setProperty('--readdy-anim-glow-cta-scale', `${options.scale ?? 1.05}`);
|
|
20
|
+
el.style.setProperty('--readdy-anim-glow-cta-padding', options.arrowPadding ?? 'calc(2rem + 1.2em)');
|
|
21
|
+
el.style.setProperty('--readdy-anim-glow-cta-idle-opacity', `${options.idleOpacity ?? 0.2}`);
|
|
22
|
+
el.style.setProperty('--readdy-anim-glow-cta-active-opacity', `${options.activeOpacity ?? 0.6}`);
|
|
23
|
+
el.style.setProperty('--readdy-anim-glow-cta-inset', `${options.inset ?? -8}px`);
|
|
24
|
+
|
|
25
|
+
if (prefersReducedMotion()) {
|
|
26
|
+
cleanups.set(el, () => {});
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const cleanup = attachPointerFollow(el, {
|
|
31
|
+
onMove(event, context) {
|
|
32
|
+
const { rect } = context.getMetrics(event);
|
|
33
|
+
const x = rect.width ? ((event.clientX - rect.left) / rect.width) * 100 : 50;
|
|
34
|
+
const y = rect.height ? ((event.clientY - rect.top) / rect.height) * 100 : 50;
|
|
35
|
+
|
|
36
|
+
el.style.setProperty(GLOW_X_VAR, `${Math.max(0, Math.min(100, x))}%`);
|
|
37
|
+
el.style.setProperty(GLOW_Y_VAR, `${Math.max(0, Math.min(100, y))}%`);
|
|
38
|
+
el.classList.add(ACTIVE_CLASS);
|
|
39
|
+
},
|
|
40
|
+
onLeave() {
|
|
41
|
+
el.classList.remove(ACTIVE_CLASS);
|
|
42
|
+
el.style.setProperty(GLOW_X_VAR, '50%');
|
|
43
|
+
el.style.setProperty(GLOW_Y_VAR, '50%');
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
cleanups.set(el, cleanup);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function destroy(el) {
|
|
51
|
+
cleanups.get(el)?.();
|
|
52
|
+
cleanups.delete(el);
|
|
53
|
+
|
|
54
|
+
el.classList.remove(CSS_CLASS);
|
|
55
|
+
el.classList.remove(ACTIVE_CLASS);
|
|
56
|
+
el.style.removeProperty(GLOW_X_VAR);
|
|
57
|
+
el.style.removeProperty(GLOW_Y_VAR);
|
|
58
|
+
el.style.removeProperty('--readdy-anim-glow-cta-scale');
|
|
59
|
+
el.style.removeProperty('--readdy-anim-glow-cta-padding');
|
|
60
|
+
el.style.removeProperty('--readdy-anim-glow-cta-idle-opacity');
|
|
61
|
+
el.style.removeProperty('--readdy-anim-glow-cta-active-opacity');
|
|
62
|
+
el.style.removeProperty('--readdy-anim-glow-cta-inset');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../magnetic-hover.js';
|
|
3
|
+
import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
|
|
4
|
+
import '../../chunks/pointer-follow-BETANySn.js';
|
|
5
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
6
|
+
|
|
7
|
+
function AnimMagneticHover({ children, padding, strength, }) {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el || prefersReducedMotion())
|
|
12
|
+
return;
|
|
13
|
+
init(el, { padding, strength });
|
|
14
|
+
return () => {
|
|
15
|
+
destroy(el);
|
|
16
|
+
};
|
|
17
|
+
}, [padding, strength]);
|
|
18
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { AnimMagneticHover };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { p as prefersReducedMotion } from '../chunks/reduced-motion-HX79Ac8G.js';
|
|
2
|
+
import { a as attachPointerFollow, g as getPointerMetrics } from '../chunks/pointer-follow-BETANySn.js';
|
|
3
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
4
|
+
|
|
5
|
+
const ANIMATION_ID = buildAnimId('magnetic-hover');
|
|
6
|
+
|
|
7
|
+
const CSS_CLASS = buildAnimClass('magnetic-hover');
|
|
8
|
+
const stateMap = new WeakMap();
|
|
9
|
+
|
|
10
|
+
function resetTransform(el) {
|
|
11
|
+
el.style.setProperty('--readdy-anim-magnetic-x', '0px');
|
|
12
|
+
el.style.setProperty('--readdy-anim-magnetic-y', '0px');
|
|
13
|
+
el.style.setProperty('--readdy-anim-magnetic-scale', '1');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function init(el, options = {}) {
|
|
17
|
+
destroy(el);
|
|
18
|
+
|
|
19
|
+
el.classList.add(CSS_CLASS);
|
|
20
|
+
resetTransform(el);
|
|
21
|
+
|
|
22
|
+
if (prefersReducedMotion()) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const padding = options.padding ?? 150;
|
|
27
|
+
const strength = options.strength ?? 3;
|
|
28
|
+
|
|
29
|
+
const onMove = (event, context) => {
|
|
30
|
+
const { rect, deltaX, deltaY } = getPointerMetrics(context.rect, event);
|
|
31
|
+
|
|
32
|
+
if (Math.abs(deltaX) > rect.width / 2 + padding || Math.abs(deltaY) > rect.height / 2 + padding) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
el.style.setProperty('--readdy-anim-magnetic-x', `${deltaX / strength}px`);
|
|
37
|
+
el.style.setProperty('--readdy-anim-magnetic-y', `${deltaY / strength}px`);
|
|
38
|
+
el.style.setProperty('--readdy-anim-magnetic-scale', '1.05');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const onLeave = () => {
|
|
42
|
+
resetTransform(el);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const cleanup = attachPointerFollow(el, { onMove, onLeave });
|
|
46
|
+
stateMap.set(el, { cleanup });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function destroy(el) {
|
|
50
|
+
const state = stateMap.get(el);
|
|
51
|
+
if (state) {
|
|
52
|
+
state.cleanup();
|
|
53
|
+
stateMap.delete(el);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
el.classList.remove(CSS_CLASS);
|
|
57
|
+
el.style.removeProperty('--readdy-anim-magnetic-x');
|
|
58
|
+
el.style.removeProperty('--readdy-anim-magnetic-y');
|
|
59
|
+
el.style.removeProperty('--readdy-anim-magnetic-scale');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../pulse.js';
|
|
3
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pulse — 按钮持续脉冲
|
|
7
|
+
*
|
|
8
|
+
* 用法:
|
|
9
|
+
* <AnimPulse><button>点击</button></AnimPulse>
|
|
10
|
+
*
|
|
11
|
+
* 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-pulse class
|
|
12
|
+
* 必须恰好包裹一个子元素
|
|
13
|
+
*/
|
|
14
|
+
function AnimPulse({ children }) {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (!el)
|
|
19
|
+
return;
|
|
20
|
+
init(el);
|
|
21
|
+
return () => {
|
|
22
|
+
destroy(el);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { AnimPulse };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
2
|
+
|
|
3
|
+
const ANIMATION_ID = buildAnimId('pulse');
|
|
4
|
+
|
|
5
|
+
const CSS_CLASS = buildAnimClass('pulse');
|
|
6
|
+
|
|
7
|
+
function init(el, options = {}) {
|
|
8
|
+
if (!el.classList.contains(CSS_CLASS)) {
|
|
9
|
+
el.classList.add(CSS_CLASS);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function destroy(el) {
|
|
14
|
+
el.classList.remove(CSS_CLASS);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../rainbow-button.js';
|
|
3
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Rainbow Button — 彩虹按钮
|
|
7
|
+
*
|
|
8
|
+
* 用法:
|
|
9
|
+
* <AnimRainbowButton><button>点击</button></AnimRainbowButton>
|
|
10
|
+
*
|
|
11
|
+
* 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-rainbow-button class
|
|
12
|
+
* 必须恰好包裹一个子元素
|
|
13
|
+
*/
|
|
14
|
+
function AnimRainbowButton({ children }) {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (!el)
|
|
19
|
+
return;
|
|
20
|
+
init(el);
|
|
21
|
+
return () => {
|
|
22
|
+
destroy(el);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { AnimRainbowButton };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
2
|
+
|
|
3
|
+
const ANIMATION_ID = buildAnimId('rainbow-button');
|
|
4
|
+
|
|
5
|
+
const CSS_CLASS = buildAnimClass('rainbow-button');
|
|
6
|
+
|
|
7
|
+
function init(el, options = {}) {
|
|
8
|
+
if (!el.classList.contains(CSS_CLASS)) {
|
|
9
|
+
el.classList.add(CSS_CLASS);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function destroy(el) {
|
|
14
|
+
el.classList.remove(CSS_CLASS);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
|
|
3
|
+
import { init, destroy } from '../shimmer-border.js';
|
|
4
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
5
|
+
|
|
6
|
+
function AnimShimmerBorder({ children, duration, borderWidth, opacity, }) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el)
|
|
11
|
+
return;
|
|
12
|
+
if (prefersReducedMotion())
|
|
13
|
+
return;
|
|
14
|
+
init(el, { duration, borderWidth, opacity });
|
|
15
|
+
return () => {
|
|
16
|
+
destroy(el);
|
|
17
|
+
};
|
|
18
|
+
}, [borderWidth, duration, opacity]);
|
|
19
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { AnimShimmerBorder };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
2
|
+
|
|
3
|
+
const ANIMATION_ID = buildAnimId('shimmer-border');
|
|
4
|
+
|
|
5
|
+
const CSS_CLASS = buildAnimClass('shimmer-border');
|
|
6
|
+
|
|
7
|
+
function init(el, options = {}) {
|
|
8
|
+
if (!el.classList.contains(CSS_CLASS)) {
|
|
9
|
+
el.classList.add(CSS_CLASS);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
el.style.setProperty('--readdy-anim-shimmer-border-duration', `${options.duration ?? 800}ms`);
|
|
13
|
+
el.style.setProperty('--readdy-anim-shimmer-border-width', `${options.borderWidth ?? 1.5}px`);
|
|
14
|
+
el.style.setProperty('--readdy-anim-shimmer-border-opacity', `${options.opacity ?? 0.88}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function destroy(el) {
|
|
18
|
+
el.classList.remove(CSS_CLASS);
|
|
19
|
+
el.style.removeProperty('--readdy-anim-shimmer-border-duration');
|
|
20
|
+
el.style.removeProperty('--readdy-anim-shimmer-border-width');
|
|
21
|
+
el.style.removeProperty('--readdy-anim-shimmer-border-opacity');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../sketch-button.js';
|
|
3
|
+
import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
|
|
4
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
5
|
+
|
|
6
|
+
function AnimSketchButton({ children }) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el || prefersReducedMotion())
|
|
11
|
+
return;
|
|
12
|
+
init(el);
|
|
13
|
+
return () => {
|
|
14
|
+
destroy(el);
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { AnimSketchButton };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
2
|
+
|
|
3
|
+
const ANIMATION_ID = buildAnimId('sketch-button');
|
|
4
|
+
|
|
5
|
+
const CSS_CLASS = buildAnimClass('sketch-button');
|
|
6
|
+
|
|
7
|
+
function init(el) {
|
|
8
|
+
if (!el.classList.contains(CSS_CLASS)) {
|
|
9
|
+
el.classList.add(CSS_CLASS);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function destroy(el) {
|
|
14
|
+
el.classList.remove(CSS_CLASS);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../blur-rise.js';
|
|
3
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Blur Rise — 卡片从模糊中升起
|
|
7
|
+
*
|
|
8
|
+
* 用法:
|
|
9
|
+
* <AnimBlurRise><div className="card">内容</div></AnimBlurRise>
|
|
10
|
+
*
|
|
11
|
+
* 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-blur-rise class
|
|
12
|
+
* 必须恰好包裹一个子元素
|
|
13
|
+
*/
|
|
14
|
+
function AnimBlurRise({ children }) {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (!el)
|
|
19
|
+
return;
|
|
20
|
+
init(el);
|
|
21
|
+
return () => {
|
|
22
|
+
destroy(el);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { AnimBlurRise };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
2
|
+
|
|
3
|
+
const ANIMATION_ID = buildAnimId('blur-rise');
|
|
4
|
+
|
|
5
|
+
const CSS_CLASS = buildAnimClass('blur-rise');
|
|
6
|
+
|
|
7
|
+
function init(el, options = {}) {
|
|
8
|
+
if (!el.classList.contains(CSS_CLASS)) {
|
|
9
|
+
el.classList.add(CSS_CLASS);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function destroy(el) {
|
|
14
|
+
el.classList.remove(CSS_CLASS);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../bounce-in-bottom.js';
|
|
3
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bounce In Bottom — 卡片从底部弹入
|
|
7
|
+
*
|
|
8
|
+
* 用法:
|
|
9
|
+
* <AnimBounceInBottom><div className="card">内容</div></AnimBounceInBottom>
|
|
10
|
+
*
|
|
11
|
+
* 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-bounce-in-bottom class
|
|
12
|
+
* 必须恰好包裹一个子元素
|
|
13
|
+
*/
|
|
14
|
+
function AnimBounceInBottom({ children }) {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (!el)
|
|
19
|
+
return;
|
|
20
|
+
init(el);
|
|
21
|
+
return () => {
|
|
22
|
+
destroy(el);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { AnimBounceInBottom };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
|
|
2
|
+
|
|
3
|
+
const ANIMATION_ID = buildAnimId('bounce-in-bottom');
|
|
4
|
+
|
|
5
|
+
const CSS_CLASS = buildAnimClass('bounce-in-bottom');
|
|
6
|
+
|
|
7
|
+
function init(el, options = {}) {
|
|
8
|
+
if (!el.classList.contains(CSS_CLASS)) {
|
|
9
|
+
el.classList.add(CSS_CLASS);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function destroy(el) {
|
|
14
|
+
el.classList.remove(CSS_CLASS);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { ANIMATION_ID, destroy, init };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { init, destroy } from '../card-fan-spread.js';
|
|
3
|
+
import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
|
|
4
|
+
import '../../chunks/constants-EnH6-Pz4.js';
|
|
5
|
+
|
|
6
|
+
function AnimCardFanSpread({ children, spreadDistance, spreadRotate, depthRotate, lift, duration, }) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el || prefersReducedMotion())
|
|
11
|
+
return;
|
|
12
|
+
init(el, { spreadDistance, spreadRotate, depthRotate, lift, duration });
|
|
13
|
+
return () => {
|
|
14
|
+
destroy(el);
|
|
15
|
+
};
|
|
16
|
+
}, [spreadDistance, spreadRotate, depthRotate, lift, duration]);
|
|
17
|
+
return React.cloneElement(React.Children.only(children), { ref });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { AnimCardFanSpread };
|