Jump to content
GreenSock

PointC last won the day on October 30 2022

PointC had the most liked content!

PointC

Moderators
  • Posts

    4,988
  • Joined

  • Last visited

  • Days Won

    401

Everything posted by PointC

  1. Hi Kathryn , You're really close. Just switch this .set(blah, {attr:{cursor: "default"}}); to this: .set(blah, {cursor: "default"}); and it works as expected. http://codepen.io/PointC/pen/KVJaGa
  2. Hi Anas7 , Welcome to the forums. You can certainly reverse a timeline on click. I'm not sure how your code is currently set up, but here's a pen showing a menu icon playing and reversing on click: http://codepen.io/PointC/pen/jWWdWb/ If you'd like specific answers about your project you can make a CodePen so everyone can see your code in action. This is the best way to get great answers from others. Here's how to make a pen: http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/ Hopefully that helps a bit. Happy tweening and welcome aboard.
  3. Hi tpav Welcome to the forums. I'd probably just put that infinite tween into a function and call it after the red box animates. I made a fork of your pen with that solution: http://codepen.io/PointC/pen/KVbjKd/ I wasn't sure if the green rotation was supposed to wait for the first revolution of the blue square or not so I put in a 1 second delay for the green square rotation. Hopefully that helps a bit. Happy tweening.
  4. You're welcome - I'm happy to help. Glad to hear that you're enjoying GSAP - it really is a fantastic platform and this forum is the best on the web. Happy tweening.
  5. Carl & Jonathan - thanks very much for the kind words. @caemostajo I've made another pen to help you understand this behavior a bit better. There are two timelines and two SVGs that are nearly identical. The first one has a shape in each corner and you can see the morph target not only assumes the shape, but the positioning of the new path. The second one is the same except all paths are centered so you get a morph with no position changes. I've also added a toggle so you can see the silhouette of the morph paths that the square is changing into. http://codepen.io/PointC/pen/LGMaoa/ Hopefully that helps you with a further understanding of what's happening with the paths. Happy morphing.
  6. Hi caemostajo Looks like you're having some fun starting to use the morph plugin. Your pen is using three different SVGs of varying sizes which is causing some issues here. You can certainly use paths in separate SVGs, but I personally prefer to use one SVG with multiple paths to get the easiest and best results. I also see two morphs happening at once and I wasn't sure if that was your desired outcome. Is the #axe supposed to morph into the #dot and then into the #brush? I assume that's what you wanted as you mentioned multi-path in your question. I'd recommend creating a single SVG and put your paths at the desired ending point even if they overlap or sit on top of each other. Then, when you are ready to morph, you set the visibility of the path(s) to which you're morphing - visibility:hidden. This allows your starting path to remain visible and take on the shape and position of the morph path(s) I have a demo pen that shows a triangle, square and circle all morphing while jumping here: http://codepen.io/PointC/pen/yejGvb To see how the paths all sit on top of each other, just delete line 11 of my CSS and play the animation. Hopefully this makes sense and helps a little bit. Happy morphing.
  7. Hi gcooke Welcome to the forums. I'm not sure I completely follow your question. It sounds like you're trying to do a bouncing ball type of effect, but your code above is showing three different elements and a duration of 40 seconds so I'm not quite sure. If it is a bouncing ball effect you're looking for, here's an excellent post: http://greensock.com/forums/topic/12741-how-to-animate-a-bouncing-ball-effect/ Here's a great bouncing CodePen by GreenSock: http://codepen.io/GreenSock/pen/4db89a13f37bcb953f38c3ba00b60706 The easiest way to get the best answers would be to provide a CodePen so we can see your code in action. Here's how to do that: http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/ Hopefully that gets you started, but as I mentioned, a demo would be great. Happy tweening.
  8. Hi spacewindow , In answer to your sub question - yes you can target points. These GreenSock pens should be of use to you: http://codepen.io/GreenSock/pen/gPGOxL http://codepen.io/GreenSock/pen/MaabXe/ Check out this blog post as well (Tween complex string-based values section) http://greensock.com/gsap-1-18-0 Hopefully that helps a bit. Happy tweening.
  9. That's a cool tip Carl. I've never used negative numbers to play from the end like that. Makes perfect sense, but I've never done it. I'll put that in the "I've learned something new today" folder.
  10. Hi teamcolab , In addition to Jonathan's great advice, you can also add a label during the testing process (just move it where you need it as you're designing), pause the timeline and play() from that point. The code would look like this: tl = new TimelineMax({paused:true}); tl.to(element,2, {x:400}) .to(element,2, {x:400}) .add("testingLabel") .to(element ,2, {x:400}); tl.play("testingLabel") Here's a really simple CodePen to show it in action: http://codepen.io/PointC/pen/GoPNwP Happy tweening.
  11. Hi caemostajo , Welcome to the forums. Dipscom is right - the overlap is causing some issues here. In particular, the code below shows an overlap of the opacity on the wave path animation. If you remove that overlap (in both wave sections) your pen runs correctly on restart(). .to("#wave", 0.4, {scale:3 ,opacity:1, transformOrigin: "50% 50%"}, "-=0.1") .to("#wave", 0.2, {opacity:0, ease: Expo.easeOut}, "-=0.2")// remove "-=0.2" and it all works as expected I'd also agree that since your second section is the same as your first animation, this is a perfect situation to create a timeline in a function so you can reuse it again. Here are a few posts with some good reading about this process: http://greensock.com/forums/topic/12361-using-functions-to-build-a-timeline/ http://greensock.com/forums/topic/12643-master-timeline-and-the-use-of-functions/ http://greensock.com/forums/topic/13650-controlling-main-thread/ Also be sure to read the blog post and watch the video about the position parameter - it's great! http://greensock.com/position-parameter Hopefully this helps a bit. Happy tweening and welcome aboard.
  12. oh sure Jonathan and Zach - go the extra mile and make new CodePens. Now my answer just makes me look lazy. Nice work guys.
  13. Hi htwinam , Welcome to the forums. You could make that happen. You'd just need to use the vanilla JavaScript equivalent wherever jQuery is being used in Diaco's pen. This site should be quite helpful to you moving forward with your project: http://youmightnotneedjquery.com/ Hopefully that helps a little bit.
  14. PointC

    SVG Gotchas!

    Animation/Workflow tip: Don’t forget - you can animate the viewBox attribute I don’t see this technique in practice (or talked about) very much, but sometimes it may be a better solution than trying to scale elements and center them. To illustrate this easy, but powerful method of SVG animation, I’ve made a simple house tour complete with some GreenSock home décor and a few nods to our great moderators. Take a look: http://codepen.io/PointC/full/OMabPa/ Some additional detailed tips about this process: How do you know the coordinates to use for the viewBox animation? Using Adobe Illustrator, you can simply view the entire SVG and hover over your desired areas for the viewBox and note the coordinates from the info panel. You can also add a square/rectangle over the area(s) you wish to zoom (make it transparent with a dashed border) and then use the coordinates of that shape as your viewBox data. You can even leave the rectangle/square in place during the animation process so you know you’re hitting the right target and then delete it before releasing the SVG into the wild. Keep aspect ratio in mind when using this technique If you start with a square (1:1) SVG, you’ll experience the best results if the areas to which you are cropping/zooming are also square. Likewise, for any rectangular areas - maybe start with a 2:1 ratio and zoom into areas that are also close to that as well. You can certainly zoom/crop to other ratios as seen in my simple demo above (two rooms are square like the SVG, but two rooms are rectangular), but it’s something to keep in mind. Also note that by changing the aspect ratio and/or cropping too close to the edge of the SVG, you can end up with some unwanted white space. As usual, IE hates SVGs You have to remember to set your SVG to overflow:hidden when animating the viewBox attribute in IE or goofy things will happen. Responsive sizing for static web delivery too You don’t necessarily have to animate the SVG viewBox either. Using different viewBox sizes, you can also show different sections of your SVG for different screen sizes. Show the whole thing to desktop users and crop to the most important part for mobile delivery etc. Finally, go big or go home Start with the biggest size you think you’ll need for your SVG. IMHO this goes for any SVG, not just those with a viewBox that will be animated. In my experience, you’ll encounter less trouble scaling down than scaling up. Hopefully this gives everyone some new ideas. Happy tweening.
  15. Hi celli , Sorry - I had to be away from my computer for a bit and didn't have a lot of time to look at it again. Looks like you found a good solution though. I'm not sure why the math doesn't work on your other version, but like you said, maybe someone else has done this effect with more success and can post some thoughts. I've been doing some parallax effects for some galleries recently, but I've been using absolutely position elements and animate the background position along with a clip animation which woks quite well. Anyway - I'm glad you have a working solution.
  16. o.k. - please see if this is more what you need? http://codepen.io/PointC/pen/PZyVQr/ Edit - nope - my mistake - that removes your parallax.
  17. Hi celli , You're exactly right - you just need to adjust the y position. I was able to compensate for your offset by changing your tween to this: TweenLite.to(window, 2,{scrollTo:{y:position1-375}, ease:Expo.easeInOut}); Once I made that change, everything looks right to me - you should get the correct stopping point while retaining the parallax effect.
  18. Thanks Carl. I actually made something similar to your demo when I first started working on an answer for this post, but switched back to the multi-path route for better control.
  19. Nicely done Jonathan! You're working too hard on a Friday night - take some time off - have some pizza or something.
  20. Hi axy2016 , Welcome to the forums. The MorphSVG plugin works path to path - so to make a square morph into three separate circles, you'd have to make your three circles into a single path and I don't think you're going to get the quality you'd like by doing it that way. To get the best results with the most control, I'd say you want to stay with a path to path process. You can make your three initial shapes look like a solid square and then morph to three circles. I made a pen to show you how that could work. http://codepen.io/PointC/pen/yeRXRx I used 2 small squares and a rectangle to create the illusion of one large square and then grouped those three elements so I could control them as if they were just one element. Those three pieces then morph into the circles. The only problem I ran into was that I could see the edges of the three elements making up the 'fake' square even though the positioning was perfect. I solved this by adding a stroke to those paths that matched the background color. I'm not sure what your project is, but hopefully this helps or gives you some ideas. Happy tweening.
  21. Hi SoL2Squiz , Looks like you're having fun getting started with GSAP. The easiest way to accomplish a starting opacity of 0 would be to set() your opacity and visibility with autoAlpha:0 and tween to an autoAlpha:1. Your pen could then be written like this: TweenMax.set(".logo",{autoAlpha:0}); TweenMax.to(".logo", 3, { x: 500, scale: .8, ease: Elastic.easeOut, autoAlpha:1, }); autoAlpha is a combination of visibility and opacity. I personally prefer autoAlpha over opacity because when autoAlpha is set to 0, the visibility is automatically set to hidden for you. That's quite nice as it prevents accidental clicking of elements that have an opacity of 0. Here's some more reading about autoAlpha http://greensock.com/docs/#/HTML5/GSAP/Plugins/CSSPlugin/ The set() method is a way for you to set the properties of your target. It's a convenient way to get your elements to the desired starting state before you tween them. More reading about set(): http://greensock.com/docs/#/HTML5/GSAP/TweenMax/set/ Hopefully that helps a bit. Welcome aboard and happy tweening.
  22. PointC

    SVG Gotchas!

    A quick tip for reversing path points in Adobe Illustrator. Open path: select the pen tool and click on the first point of your path and it will reverse the points. Closed path: right click the path and make it a compound path, choose menu-window-attributes and then use the Reverse Path Direction buttons. (Note: If the Path Direction buttons are not visible in the attributes panel, click the upper right menu of that panel and choose 'Show All')
  23. Hi pauloco , Welcome to the forums. This is really more of a ScrollMagic rather than a GreenSock question, but I can certainly answer it for you. Just add reverse:false to your scene parameters like this: new ScrollMagic.Scene({ triggerElement: '#redBox', reverse:false }) The animation will then play when you scroll down, but stay put when you scroll up again. Here's some more reading about it: http://janpaepke.github.io/ScrollMagic/docs/ScrollMagic.Scene.html#constructor Happy tweening.
  24. Just a final thought here. You can group a single element. I made a quick fork of my pen to show you that diagonal movement you were expecting. Notice if I rotate the group with a single child element, the coordinate system rotates, but when I rotate the rectangle by itself, the coordinate system does not change. http://codepen.io/PointC/pen/gPdEOP/ All the best - happy tweening.
×