MCPcopy
hub / github.com/DavidHDev/react-bits / SplitTextDemo

Function SplitTextDemo

src/demo/TextAnimations/SplitTextDemo.jsx:32–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30};
31
32const SplitTextDemo = () => {
33 const { props, updateProp, resetProps, hasChanges } = useComponentProps(DEFAULT_PROPS);
34 const { delay, duration, ease, splitType, showCallback } = props;
35
36 const [key, forceRerender] = useForceRerender();
37
38 const propData = useMemo(
39 () => [
40 {
41 name: 'tag',
42 type: 'string',
43 default: '"p"',
44 description: 'HTML tag to render: "h1", "h2", "h3", "h4", "h5", "h6", "p",'
45 },
46 { name: 'text', type: 'string', default: '""', description: 'The text content to animate.' },
47 {
48 name: 'className',
49 type: 'string',
50 default: '""',
51 description: 'Additional class names to style the component.'
52 },
53 {
54 name: 'delay',
55 type: 'number',
56 default: '50',
57 description: 'Delay between animations for each letter (in ms).'
58 },
59 {
60 name: 'duration',
61 type: 'number',
62 default: '1.25',
63 description: 'Duration of each letter animation (in seconds).'
64 },
65 { name: 'ease', type: 'string', default: '"power3.out"', description: 'GSAP easing function for the animation.' },
66 {
67 name: 'splitType',
68 type: 'string',
69 default: '"chars"',
70 description: 'Split type: "chars", "words", "lines", or "words, chars".'
71 },
72 {
73 name: 'from',
74 type: 'object',
75 default: '{ opacity: 0, y: 40 }',
76 description: 'Initial GSAP properties for each letter/word.'
77 },
78 {
79 name: 'to',
80 type: 'object',
81 default: '{ opacity: 1, y: 0 }',
82 description: 'Target GSAP properties for each letter/word.'
83 },
84 {
85 name: 'threshold',
86 type: 'number',
87 default: '0.1',
88 description: 'Intersection threshold to trigger the animation (0-1).'
89 },

Callers

nothing calls this directly

Calls 2

useComponentPropsFunction · 0.85
useForceRerenderFunction · 0.85

Tested by

no test coverage detected