Search the Community
Showing results for tags 'svg'.
-
Hello, i'm trying to create this animation in which I will have many lottie animations that will be chained one after another (basically, it should've been only one big animation, but I don't think it would've been good performance-wise, so I'll have to split in more animations and position them so they connect seamlessly and only play one or two at a time). For now I'm using svgs to test things out. My issues are the following: 1: Each section has a different height and will need to be scrolled a slightly different vertical/horizontal amount, and I'm not sure I'm doing it correctly. Is it ok to animate the same properties of the same element in the same scrolltrigger like I'm doing? 2: Sometimes the performance doesn't seem great and I was wondering if the issue was the way I'm chaining the svgs together and gsap having to do some more intensive work (?) 3: I can't get the snapping to work perfectly and i'd really appreciate some suggestions on how to achieve that. For now I just managed to get a magic number working ( snap: 1/5.24). Here's the codesandbox, I didn't use codepen because It didn't allow me to add custom images as files https://codesandbox.io/p/sandbox/lively-field-29rqgq?workspaceId=0594864b-79ee-45da-baa8-7022bffe9845
-
Hello GSAP community! I'm trying to animate text and svgs but I don't know why this is not looking great! what I'm trying is to do simillar to gsap home page text animations but not exact same (refer to attached img). so i want to animate ADS word with svgs so each word will go down and svg will come in place with some animation but couldn't figure it out, how do i do it! Please help me out!
-
Im trying to move clip path inside SVG along x axis while element that is inside clip path to be cliped by clip path and stay in position - in order to make a layered effect. Im not sure if I described it correctly. Or is there any other technique to achieve this. This is my CodePen https://codepen.io/drol/pen/VwJqPpd
-
Good afternoon everyone, I have been trying to draw an SVG Squiggle line using the ScrollTrigger. The idea is that it progresses as you scroll down. However, up until now, the line has already partly progressed when I load the page. It does 'draw' further when I scroll, so that works. I also wanted to try to make the animation responsible, I have tried increasing the size of the SVG as a creative solution, but any suggestions are welcome! Here is a DEMO: https://stackblitz.com/edit/gsap-react-basic-f48716-3rj7zk?file=src%2FApp.js since I am working with React. Anyway, I hope you can give me some suggestions based on my code. Thanks in advance!
-
I've created a reveal animation using an SVG mask to reveal the content of the page. The animation works perfectly on Chrome and other browsers. However, on iPhone iOS 16 and macOS Safari, the SVG is not revealing the content as expected. The CodePen link to my project has been added above Issue Description: The reveal animation functions correctly on Chrome and other browsers. On iOS 16 (iPhone) and macOS Safari, the SVG mask does not reveal the content. I've ensured the SVG and GSAP animations are correctly implemented. The problem only persists on Safari browsers, specifically on iPhone iOS 16 and macOS. I've tested on different devices and the issue seems consistent on Safari. Questions: Is there a known issue with SVG masks and animations on Safari, especially on iOS 16 and macOS? Are there any workarounds or fixes that can ensure the reveal animation works on Safari as well? Is there a more compatible way to implement this SVG mask reveal animation that ensures cross-browser functionality? Any help or suggestions would be greatly appreciated! Thank you in advance for your assistance. I've ensured the SVG and GSAP animations are correctly implemented. The problem only persists on Safari browsers, specifically on iPhone iOS 16 and macOS. I've tested on different devices and the issue seems consistent on Safari. Here is a video link for the demo on IOS: imgur.com/MssoPXF
-
Hi, I've finally stepped into the beautiful world of GSAP. The last few hours have been challenging, yet really satisfying. Let me elaborate the problem. I've a circular SVG, with 4 words (of varying length) written on it. Its supposed to get pinned on the screen and as the user scrolls down, each word will rotate to 12 o'clock. The section will unpin when it completes a cycle and normal scrolling will continue. I read the documentation and watched some videos, this is what I've achieved so far. I'm able to pin the section, and make the SVG rotate 360 degrees before it unpins. But its not really "snapping" (I hope its the correct term) to the next word, which is the desired behaviour. I've grouped the words together and given them a class. I'll really appreciate it if someone could look at the attached CodePen and help me with the challenge. Or point me towards the relevant topics that I need to learn about in order to achieve the result. Thank you!
-
Namaste Guys, I am trying to create one animation on scroll with a svg line but can't achieve as expected. here is the screenshot and also the reference site https://thevariable.com/ I have tried so far is in the stack https://stackblitz.com/edit/react-mmp4w3?file=src%2Fstyle.css
-
Hello, Recently I have started using GSAP more to add unique & subtle animations to various client sites. I am really enjoying it, and am hoping someone can help explain this small issue I've encountered. I came across a Youtube video - link here - explaining how to animate SVGs using ScrollTrigger on top of images to make it appear as though the image is moving as the user scrolls. A staging site was created to attempt to recreate this - link here . I don't know if this needs to be mentioned but one difference between my staging site and the video I am referencing is that the video author is using Webflow whereas I am using a Wordpress on my staging site. I have added 2 SVGs on top of an image - one set to position: absolute at top center of the image, one set to positon:absolute at the bottom center of the image. The top one works great. Zero issues there. The bottom SVG, while it moves as you scroll, is completely distorted. It should be a similar looking soft curve to the one used at the top. Unfortunately, it looks extremely boxy and not at all like the before & after versions I created to use as the initial path and final path. For context, here are the 2 SVG codes and the script I added to the body of the page: Top SVG - No issues here: <svg width="100%" viewBox="0 0 1444 271" fill="none" xmlns="http://www.w3.org/2000/svg"> <path wb-element="path-to-animate" d="M1188 25C1520 3 1444 0.433105 1444 0.433105H0C0 0.433105 856 47 1188 25Z" wb-final-path="M1310 137C1669 81.3633 1600 0 1600 0H0C0 0 950.997 192.637 1310 137Z" fill="#fff" /> </svg> Bottom SVG - scrolls but extremely distorted: <svg width="100%" viewBox="0 0 1603 239" fill="none" xmlns="http://www.w3.org/2000/svg"> <path wb-element="path-to-animate" d="M0 239V0C0 0 265.834 96.3134 841.474 103.448C1417.11 110.582 1601 3.56716 1601 3.56716V239H0Z" wb-final-path="M1.00012 37.0769L1.00012 41.0223C7.5277 54.8358 82.2768 105.281 760 198C1567.41 308.462 1599.93 0 1599.93 0V241H1.00018L1.00012 41.0223C-0.249021 38.3789 1.00012 37.0769 1.00012 37.0769Z" fill="#fff" /> </svg> Script added to body: <script> const pathsToAnimate = document.querySelectorAll( '[wb-element="path-to-animate"]' ); pathsToAnimate.forEach((path) => { const finalPath = path.getAttribute("wb-final-path"); gsap .timeline({ scrollTrigger: { trigger: path, start: "top bottom", end: "bottom top", scrub: 1 } }) .to(path, { attr: { d: finalPath }, ease: "none" }); }); </script> At this point I am not sure what to do so I am really hoping some form of guidance can be provided here. Thank you, everyone!
-
Hi, I'm working on this animation using ScrollTrigger & MorphSVG: https://codepen.io/jakievu/pen/zYQEwyY But I have trouble positioning the animation in the middle of the page (horizontally + vertically). The animation keep leaning to the left side even though I've set all the transform origin to center. This is what I'm trying to achieve: https://codepen.io/jakievu/pen/ZEZJLWV The animation stick to center as well as resize responsively. The only difference between those 2 codepen above is that I'm wrapping the <video> inside a <div> tag instead of a <foreignobject> tag because that's the only way clip-path would work on Safari. Hopefully someone can help! Thank you
- 3 replies
-
- morphsvg
- scrolltrigger
-
(and 2 more)
Tagged with:
-
Hi everyone, Can anyone help me figure out on how to do this type of animation on scroll. It is a canvas with svg patterns, and when the user scrolls it will start scaling the 1st row from a smaller size to the initial svg width and height. Not sure how to make this one work Would really appreciate if someone can help me. I have had an attempt, maybe it is a good start but I can't figure it out properly. I have also break down the code into parts from the https://remote.com/global-hr/contractor-invoicing-and-payments https://i.imgur.com/hXHepSI.mp4 HTML <div class="sc-f1d6031c-0 hjWElG pattern-transition" from="white" to="red500"> <canvas width="5080" height="868"></canvas> <svg width="78" height="40" viewBox="0 0 78 40" xmlns="http://www.w3.org/2000/svg" class="pattern duo-petal pattern-ref" style="fill: pink;"> <path d="M39 39.9939C47.9212 39.939 60.9436 36.5061 67.7442 29.6951C74.3072 23.122 77.7258 14.2683 78 5.54268V0H76.507C66.495 0.195122 56.2148 2.82317 48.5672 10.4878C43.4911 15.5732 40.3162 21.8232 39 28.378C37.6838 21.8232 34.5089 15.5732 29.4328 10.4878C21.7852 2.82317 11.505 0.195122 1.49297 0H0V5.54878C0.280313 14.2744 3.69891 23.128 10.2558 29.7012C17.0564 36.5122 30.0727 39.9451 39 40"></path> </svg></div> CSS .hjWElG { position: relative; width: 100%; display: grid; margin-top: -0.5px; margin-bottom: -0.5px; background-color: #ffffff; } /*!sc*/ .hjWElG canvas { width: 100%; height: auto; } /*!sc*/ .hjWElG .pattern-ref { position: absolute; visibility: hidden; pointer-events: none; } document.addEventListener("DOMContentLoaded", function() { const canvas = document.querySelector('canvas'); const ctx = canvas.getContext('2d'); const svgPath = document.querySelector('svg path').getAttribute('d'); const patternColor = 'pink'; // Color of the SVG fill let pattern; let maxScale = 1; // Maximum scale at the bottom of the page // Function to draw the SVG path into a canvas pattern function drawPattern(scale) { const scaledWidth = 78 * scale; const scaledHeight = 40 * scale; const blob = new Blob([`<svg xmlns='http://www.w3.org/2000/svg' width='${scaledWidth}' height='${scaledHeight}'><path fill='${patternColor}' d='${svgPath}' transform='scale(${scale})'/></svg>`], {type: 'image/svg+xml'}); const url = URL.createObjectURL(blob); const img = new Image(); img.onload = function() { pattern = ctx.createPattern(img, 'repeat'); updateCanvas(scale); URL.revokeObjectURL(url); }; img.src = url; } // Function to update canvas drawing based on scroll function updateCanvas(scale) { ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = pattern; ctx.save(); ctx.scale(scale, scale); ctx.fillRect(0, 0, canvas.width / scale, canvas.height / scale); ctx.restore(); } // Update the canvas on scroll window.addEventListener('scroll', function() { const scrollPercent = window.scrollY / (document.body.scrollHeight - window.innerHeight); const scale = Math.max(scrollPercent, 0.1) * maxScale; // Scale starts from 0.1 to 1 drawPattern(scale); }); // Resize canvas dynamically and redraw pattern window.addEventListener('resize', function() { canvas.width = window.innerWidth; canvas.height = window.innerHeight; const scale = window.scrollY / (document.body.scrollHeight - window.innerHeight) * maxScale; drawPattern(Math.max(scale, 0.1)); }); // Initial setup canvas.width = window.innerWidth; canvas.height = window.innerHeight; drawPattern(0.5); // Start with the smallest scale });
- 3 replies
-
- svg pattern scroll animation
- scroll
-
(and 3 more)
Tagged with:
-
Hello developer, hope you all are doing well. I want my svg to start from the center of the screen, keep animating at the center of the screen and end its animation at the center of the screen. for now, I am using an SVG and keep its height 0 and then it animates to its full height. I am using it for my timeline project but the line starts normally then moves away from the center and speeds up and leaves the screen to the bottom.
- 9 replies
-
- scrolltrigger
- svg
-
(and 1 more)
Tagged with:
-
Hi I think a project I will be doing soon will require the drawSVG plugin to animate an svg path. I know that this is a benefit of the GSAP membership and the files are downloaded from the member area. What i would like to know is the drawSVG plugin an additional js file that will need to be included in the creative and therefor its file size or is it included in the file size exclusions that GSAP generally benefits from. thanks
-
Hellow Everyone! Just need a little help. I only want to show the path that the SVG (Rocket )has covered and not the whole path. as the rocket goes up the path is shown. https://codepen.io/Fawad4real/pen/LYaaOZG
- 4 replies
-
- scrolltrigger
- timeline
-
(and 1 more)
Tagged with:
-
I was trying to animate SVG using the DashOffset property. When the animation ends, the timeline is not aligned with the SVG strokeDashoffset. I know we have to match the exact offset to hide the strokes but, is it possible to make align both?
- 2 replies
-
- svg
- stroke-dashoffset
-
(and 1 more)
Tagged with:
-
Hey there! I have a request. I have completed 95% of the animation, but I'm facing an issue with the last item. I want the icons to loop at a specific distance repeatedly, but the problem is that each icon completes a duration of 40s and gets merged together, which is not what I want. Do you have any solutions for this issue? Thanks! issue I am facing. what I want is something like this, which keeps moving in an infinite loop at a slow speed. my codepen https://codepen.io/Fawad4real/pen/bGZLVOy
-
Hi everyone! I'm working on a landing page and I need to create a pre-loader that uses my handwritten logo as an SVG. Desired effect: The desired effect is a Stroke Reveal, implemented with GSAP3. How can I achieve this effect? Logo positioning: After loading, the logo/preloader should be positioned centrally on the navbar. Request for help: To achieve this project, I would need your help. What should I study? Best practices? What resources and tutorials do you recommend to learn more about?: Creating pre-loaders Stroke Reveal effect with GSAP3 Dynamic positioning of SVG elements What can I get inspiration from? Do you have any examples of websites or projects that use similar effects? Conclusion: Thank you in advance for your support! Additional information: I'm using GSAP3 My logo is a handwritten SVG The landing page is developed in HTML, CSS and JavaScript Thank you very much for your help!
-
I have been struggling to find a way to center a select number of groups from an svg in their respective container. For some reason, the groups are always a little off. The "navyDots" all need to be vertically center at the end of the timeline.
-
Hi Team, What I'm trying to achieve The overall effect is curvy timeline (vertical) that is revealed as the user scrolls down the page. As the user scrolls down the page, the curved line is drawn, dots are added to the line and content is revealed. The content is sourced from a CMS (rows), there are unknown number of rows, and the content in each row can vary in size/height The Tech This is all being done in React My approach I've broken the curvy line into multiple sections: Top - The start of the timeline (Data row 1) Middle 1 - The first Section (Data row 2) Middle 2 - The second section (data row 3) ...n middles sections Bottom - The end of the timeline Each is its own component which is responsible for the animation. Where I'm struggling All this, for the most part works OK. Where I'm getting unstuck is: 1) Nicely transitioning from row to row (leading dot on the motion path) 2) On scroll up removing the lead dot. I have a demo in stackbitz, I hope this is ok? I realise there's a bit going on in this so let me know if I need to simplify further. https://stackblitz.com/edit/react-ahd2tq?file=src%2FApp.js
- 3 replies
-
- svg
- motionpath
-
(and 1 more)
Tagged with:
-
Hi! I want to begin by thanking the developers of GSAP for creating this wonderful tool. I have been using it since 2018. My question is pretty straightforward from the title. An example scenario can be found in the CodePen demo. Basically, when I want to rotate a square by 90 degrees around a point (in the demo, it is (300, 200) in SVG coordinate, as indicated by the blue dot), the transformation matrices needed are first a Translation matrix T_{-1} that offsets the object by -300, -200, then a Rotation matrix R that rotates the object by 90, then the inverse of that first Translation matrix T that brings the object back by offseting it with 300, 200. The final aggragated transformation matrix is then the product of (T)(R)(T_{-1}) By inspecting the final transformation matrix that GSAP sets for the square element via the transform attribute, I am pretty sure this is how GSAP handles rotation around an arbirtrary point, instead of setting the transform-origin attribute. I wonder then how I can access each of the individual T, R, and T_{-1} matricies? If there is not a direct function call to get these, can you point to me where in the source were these matricies computed? Thanks!
-
Hello Greensock. I'm playing arond with the MorphSVG Plugin but i'm having some problems. How can i morph between two svg with different number of path?! (please see the codepen for more details) I can also select the entire of path in each group but that's not the way. I will attach two svg also. Hope i can get the help. Thanks! work-svg.svg qd-svg.svg
-
I've been working on a website for a customer, but I probably made the poor choiche of deciding to animate an svg for the hero section where i animated the position of 2 ellipse with a blur effect. The performance are great on desktop but on mobile it barely even works causing lots of lags. https://dreamteamdesign.majestico.it I'm talking about the animation that start from the circle mask to the end of the animated gradient. What would be the ideal way to animate this? Should I animate using canvas? Do you know if there's an example of something similar? Thanks
-
I have learned from the doc that how can I animate rect along path. For advance, how can I make the arc-shaped element(id="pin-arc" in the codepen demo) move around the circle path, and always fits to the circle radian? Is this possible with only MotionPathPlugin? Or are there any other solution for this, (yet prefer not to includes other plugins). Thank ahead!
-
Hello guys. Attached code pen. I am new to GSAP and you can see the animation its basically at a background on a website I want to start showing this on my scroll trigger with my scrub I am a little new to gsap cannot do it can you guys please check it. Attaching the SVG too if you want to do it. The gaps that are coming has elements between them and it will come like this in the attached screen shot. Attaching the svg too. Please make it happen for me. Group 35.svg
- 1 reply
-
- scrolltrigger
- svg
-
(and 3 more)
Tagged with:
-
Hello all of you, I'm trying to create an icon animation where the two lines that make it up must always rotate in a clockwise direction, regardless of the animation state (forward or backward). Despite the need to create the simplest possible demonstration, I've still used the VueJS3 Framework, because I wonder if the unexpected result I'm getting isn't somewhat related to the way the functions are launched. I'm really having trouble understanding why I'm getting the result I'm getting. If anyone can shed some light on this, I'd be very grateful! - Why the animation seems incomplete at the first click - Why on second click there is just one element moving up - Why on all next click the animation seems to be played at reverse Expected result: On first click, the "chevron" icon rotate clockwise to look up ? On second click, the "chevron" icon still rotate clockwise to retreive is initial look down ? and so one. So the icon has two state (up and down) but toggle it by rotating always clockwise.
-
Hi, im working on this zoom in transition using clipPath and ScrolTrigger but im having issues with properly transitioning from one path to another. I am not sure if the issue lies in my gsap animation code, or if I prepped my svgs incorrectly. Here is a link to a demo of it https://codepen.io/akalex-x/pen/mdvOLxX As you can see it starts as a small flag crop that then grows full screen, and then I wanted to change it into a simple rectangle shape but when I try to do that it instead jumps to an awkward crop. I made my SVGs in figma and made sure they are the same size and have the same about of points. I then exported the SVGs and used https://yoksel.github.io/relative-clip-path/ to change the absolute paths to relative. Any help here will be super appreciated, thanks!