Split Text #2
Component Structure
ST2 SB TRIGGER (Section): This serves as the scrollable trigger area for the animation, extending to
300vhin height with thest2-sb__triggerclass applied for styling and to identify the trigger zone.Within the ST2 SB TRIGGER, a Div element is placed to center the text container vertically within the viewport, making use of a flex display to align its child container.
Container: Directly holds the Text-Basic element, ensuring it's properly positioned within the vertical center of the section.
ST2 SB TARGET (Text-Basic): The text to be animated, split into lines as the user scrolls. The
st2-sb__targetclass applies specific styles and animations, including a dynamic background clip effect that reveals the text in a unique manner as the page scrolls.
Animation Structure
ST2 - SCRUB - ANIMATION
This timeline consists of animations that are triggered by scrolling within the .st2-sb__trigger section:
Text Split Animation: Splits the text into lines (
splitTextTypeset to "lines"), enabling the animation to target each line individually for a more detailed and dynamic effect as the user scrolls.Background Width Animation: Adjusts the
--bg-widthcustom property from0%to100%over the duration of the scroll through the trigger area. This effect creates a revealing animation for the text, where the text color changes as the background "fills in" behind it. The.st2-sb__target .brf-split-linesselector indicates that this animation targets the background of the split lines, with a staggered delay (staggerValueof 0.5) to enhance the visual impact.
The scroll-triggered animation is set to pin the ST2 SB TRIGGER section, creating a fixed position effect for the duration of the scroll through this section. The scrub property is enabled with a scrubValue of 2, ensuring a smooth transition of the animation tied directly to the scroll speed and position.
Key Features
Custom CSS for Split Text: The
st2-sb__targetclass includes custom CSS that implements the background clip effect on the text, dynamically controlled through the--bg-widthvariable adjusted by the scroll animation.
Last updated