Jump to content
Search Community

Unable to fix pin spacing

pabschabs test
Moderator Tag

Recommended Posts

Hi

I am trying to build out a design around 2 svg elements. The elements will move in and out of the screen revealing things like a video when you scroll down. 

I would then roll the elements back in and they would be used as a background for text.

Unfortunately i am quite stuck on the pin spacing. I have tried a few suggestions but feel there is something basic i am missing and simply cannot identify.

How can i make these elements cover the entire screen and as you scroll they roll away revealing the video?



Thank you!

Paul

See the Pen NWYXZra by paul-cullen (@paul-cullen) on CodePen

Link to comment
Share on other sites

Hi there! Welcome to the forums.

 

GSAP wise you can just use one ScrollTriggered timeline for both your animations
 

gsap.timeline({
 scrollTrigger: {
  trigger: "#section_1",
  ...
}
}).to(".circle_container_2",  { width: "140%", x: "-75%", rotation: -60})
  .to(".circle_container_1",  { width: "120%", x: "-75%", rotation: 45}, '<');


I'm not certain what you're after visually though. Sounds like more of a styling conumdrum! You probably just need to position the SVG as a fixed element?

Link to comment
Share on other sites

No I meant using position:fixed to position the SVG over the whole screen so everything will scroll underneath it? Not quite sure what you're after though so this might not be helpful.

 

Also you can't use 'width' for groups in SVG. Maybe you're looking for scale? And as you're using percents for the x movement you can use xPercent instead.
 

.to(".circle_container_2",  { scale: 4, xPercent: -75, rotation: -60})

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...