How to import?
Select the “Paste (All)” option from the Structure panel, or another method involves clicking on an empty area within the Structure panel, pressing the “Esc” key followed by the “Ctrl/Cmd + V” key combination.
Structure & Styling
NOTE: You can copy the Bricks Structure if you don’t want to rebuild this.
1. HERO SECTION, HORIZONTAL SCROLL SECTIONS, FOOTER SECTION
Start by adding 5 SECTIONS to a blank page. Name them as you like. In this case I am using:
- HERO SECTION
- SECTION 1, SECTION 2, SECTION 3
- FOOTER SECTION
HERO SECTION
Add a class of .hero-section to your HERO SECTION and add following styles:
height: 100vh
background-color: #243300 or as you like
Add a CONTAINER inside of .hero-section and inside the CONTAINER add a HEADING.
You can style the HEADING as you like. In my case I am using:
#d0b3f for the text-color
All HEADINGS have a font-size of 10rem
HORIZONTAL SCROLL SECTIONS
Give SECTION 1, SECTION 2 and SECTION 3 a class of .h-scroll_section and add following styles:
flex: center it on all axis
flex-shrink: 0 <- IMPORTANT
width: 100%
height: 100vh
max-height: 100vh -> to prevent the SECTIONS to go over 100vh.
You can add a background-color to each SECTION on the ID level.
In this case I am using:
SECTION 1: #6300ff
SECTION 2: #243300
SECTION 3: #efe6ff
Add a CONTAINER to each .h-scroll_section and inside each CONTAINER add a HEADING.
You can style the HEADINGS as you like. In my case I am using:
SECTION 1 – HEADING: #e8ffb3
SECTION 2 – HEADING: #d0b3ff
SECTION 3 – HEADING: #6300ff
All HEADINGS have a font-size of 10rem
FOOTER SECTION
Give the FOOTER SECTION a class of .footer-section and add following styles:
height: 100vh
background-color: #d0b3ff <- or as wanted
Add a CONTAINER inside of .footer-section and inside the CONTAINER add a HEADING.
You can style the HEADING as you like. In my case I am using:
#243300 for the text-color
All HEADINGS have a font-size of 10rem
Your structure should now look like this:
2. HORIZONTAL SCROLL WRAPPER & TRIGGER
HORIZONTAL SCROLL WRAPPER
Create a DIV and give it a class of .h-scroll_wrapper. Add following styles:
display: flex
flex-direction: horizontal (row)
Insert all SECTIONS with a class .h-scroll_section inside of .h-scroll_wrapper
HORIZONTAL SCROLL TRIGGER
Create a DIV and give it a class of .h-scroll_trigger. Add following styles:
overflow: hidden
Insert .h-scroll_wrapper inside of .h-scroll_trigger.
Your structure should now look like this:
GSAP with Bricksforge
NOTE: You can download the “Horizontal Scroll Snap – MAIN” Timeline if you don’t want to rebuild this.
Ok, as we have the HTML structure and styling set up, we will now build the horizontal scroll animation including snap and pin.
Open the Bricksforge Panel. Click on Timelines and add a new Timeline. Give the Timeline a descriptive name like: Horizontal Scroll Snap.
Assign the following settings in the Settings Column:
Trigger: ScrollTrigger
Trigger Selector: .h-scroll_trigger
Handle triggers separately: ON
Scroll Start: top 0%
Scroll End: top -200%
Use Scrub: ON
Smooth Scrub Value:0
Use Pin:ON
For Selector:.h-scroll_trigger
Pin Spacing:ON
Use Snap:ON
Snap To:0.5
Why 0.5? We will have 2 SECTIONS that will scroll horizontal. SECTION #1 is the starting SECTION (0%). SECTION #2 is the first SECTION to scroll (-100%) and SECTION #3 ist the second SECTION to scroll (-200%). So if -200% equals the full horizontal scroll width, -100% would represent the half of it, which leads the a value of 0.5. If we would have 3 SECTIONS to scroll the total scroll width would be -300%, so each SECTION would be a third, which would lead to a value of 0.333333.
Snap Duration:0.5
Snap Delay:0
Snap Ease:default
Now add a Animation in the Animations Column with the following settings:
Method: To
In the To Tab:
Transalte X: -200%
ADDITIONAL: Set an entrance animation of each horizontal scroll section.
NOTE: You can download the “Horizontal Scroll Snap – Section Start – Text” Timeline if you don’t want to rebuild this.
FIRST SECTION:
Open the Bricksforge Panel. Click on Timelines and add a new Timeline. Give the Timeline a descriptive name like: Horizontal Scroll Snap – Section #1 – Text.
Assign the following settings in the Settings Column:
Trigger: ScrollTrigger
Trigger Selector: #brxe-lzqpxg -> ID or CLASS of Section #1
Scroll Start: -20% top
Now add a Animation in the Animations Column with the following settings:
Method: From
In the From Tab:
Selector to animate: #brxe-anckje -> ID or CLASS of your HEADING in SECTION #1
Translate Y: 20px
Opacity: 0
Duration: 0.5
Delay: 0.3
Ease: power1.in
NOTE: You can download the “Horizontal Scroll Snap – Section#2 – Text” Timeline if you don’t want to rebuild this.
FOLLOWING SECTIONS:
Open the Bricksforge Panel. Click on Timelines and add a new Timeline. Give the Timeline a descriptive name like: Horizontal Scroll Snap – Section #2 – Text.
Assign the following settings in the Settings Column:
Trigger: ScrollTrigger
Trigger Selector: #brxe-lzqpxg -> ID or CLASS of Section #1
Scroll Start: +=100% top
Scroll End: +=100% top
Method: From
In the From Tab:
Selector to animate: #brxe-utebvr -> ID or CLASS of your HEADING in SECTION #1
Translate Y: 20px
Opacity: 0
Duration: 0.5
Delay: 0.3
Ease: power1.in
Duplicate this Animation for each Scroll Section.