We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got the following code in react
` import React, { useEffect, useRef } from "react"; import { gsap } from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; import SplitType from "split-type"; interface SplitProps { children: React.ReactNode; splitMode: String; delay: number; } const Split = ({ children, splitMode, delay = 0 }: SplitProps) => { const trigger = useRef<HTMLDivElement>(null); const target = useRef<HTMLDivElement>(null); useEffect(() => { gsap.registerPlugin(ScrollTrigger); const init = () => { split(); }; const animate = (text) => { gsap.from(text, { delay: delay, y: "105%", duration: 0.5, stagger: 0.05, ease: "power2.in", force3D: true, scrollTrigger: { trigger: trigger.current, scrub: false, }, }); }; const splitChars = () => { const text = new SplitType(target.current!, { splitClass: "split-text", types: "chars" }); animate(text.chars); }; const splitLines = () => { const text = new SplitType(target.current!, { splitClass: "split-text", types: "lines" }); animate(text.lines); }; const splitWords = () => { const text = new SplitType(target.current!, { splitClass: "split-text", types: "words" }); animate(text.words); }; const split = () => { if (splitMode === "chars") { splitChars(); } else if (splitMode === "lines") { splitLines(); } else if (splitMode === "words") { splitWords(); } }; init(); }, []); // Empty dependency array ensures that the effect runs once after the initial render return ( <span ref={trigger} className="inline-block"> <span ref={target} className="inline-block overflow-hidden overflow-clip"> {children} </span> </span> ); }; export default Split; `
This outputs code like this for example if we are using lines
<span class="inline-block overflow-hidden overflow-clip"> <div class="split-text line">Lorem ipsum dolor sit amet, consectetur..</div> <div class="split-text line">Lorem ipsum dolor sit amet, consectetur..</div> </span>
What i want to do is wrap the
<span class="inline-block overflow-hidden overflow-clip"> <div class="split-text-wrapper"> <div class="split-text line">Lorem ipsum dolor sit amet, consectetur..</div> </div> <div class="split-text-wrapper"> <div class="split-text line">Lorem ipsum dolor sit amet, consectetur..</div> </div> </span>
is this possible?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Got the following code in react
This outputs code like this for example if we are using lines
What i want to do is wrap the
is this possible?
The text was updated successfully, but these errors were encountered: