pabschabs Posted August 1, 2022 Share Posted August 1, 2022 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 More sharing options...
Cassie Posted August 1, 2022 Share Posted August 1, 2022 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 More sharing options...
pabschabs Posted August 1, 2022 Author Share Posted August 1, 2022 When you say a fixed element do you mean in img tags? if so that doesn't change anything. I just avoided hosting the images. Thanks for your help though! Link to comment Share on other sites More sharing options...
pabschabs Posted August 1, 2022 Author Share Posted August 1, 2022 When you say a fixed element do you mean in img tags? if so that doesn't change anything. I just avoided hosting the images. Thanks for your help though! Link to comment Share on other sites More sharing options...
pabschabs Posted August 1, 2022 Author Share Posted August 1, 2022 I have edited the original codepen and tweaked the code as you suggested. Thanks Paul Link to comment Share on other sites More sharing options...
Cassie Posted August 1, 2022 Share Posted August 1, 2022 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 More sharing options...
pabschabs Posted August 1, 2022 Author Share Posted August 1, 2022 I will try all of these and get back to you! What about the length of time it takes to get to the next section? The one in blue? Do you know what is increasing the scroll distance so much? Link to comment Share on other sites More sharing options...
pabschabs Posted August 1, 2022 Author Share Posted August 1, 2022 What i would like to have is just as the circles are rolling out the video is fading in. Currently the circles roll out, then we continue to scroll for days and then the video comes into view. Link to comment Share on other sites More sharing options...
GreenSock Posted August 2, 2022 Share Posted August 2, 2022 It was just a typo in your code: // BAD pinspacing: false // GOOD pinSpacing: false See the Pen yLKvORo?editors=0010 by GreenSock (@GreenSock) on CodePen Does that help? Link to comment Share on other sites More sharing options...
pabschabs Posted August 2, 2022 Author Share Posted August 2, 2022 OMG thank you so much! Sometimes when you stare at the same screen for so long you miss the most obvious things! 1 Link to comment Share on other sites More sharing options...
GreenSock Posted August 2, 2022 Share Posted August 2, 2022 It happens to all of us Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now