Search the Community
Showing results for tags 'custombounce'.
-
Problems with Squash: Combining CustomBouce and MotionPathPlugin
Robert Pfaff posted a topic in GSAP
Thank you for reviewing my issue. I can make CustomBounce and MotionPathPlugin work together to a degree, but I can't produce my desired results. You'll understand if you go the codepen linked here - or view its many forked cousins online. I also joined Creative Coding Club for the additional resources. It's been great, and the lessons on SVG animation gave me some instruction that helps. But, alas, I cannot produce the results I need to produce. To be fair, Carl uses an older version of the Custom Ease visualizer in the videos, which does throw me. The GUI is different. My output is not comparable to the output he receives. In this animation, I need much better control over squash and strength - enough to bring 2-3 seconds of levity to an otherwise simple handwriting animation. In simplest terms... What's the best way to combine the functionality of both plugins to control the reactions (especially squash) when the falling circle ("#dot") collides with a letter in the company name or "Splash"? For the visual context, I have provided the Codepen link to the latest attempt. There are many iterations and weeks of effort. For those who want more detail: The small ball drops from above and bounces two-three times between the letters in the company's name. In some versions, it swoops down and gains momentum as it sweeps through the inner curvature in the cursive letter L (id=#Lpath"). It makes sense given the font I've chosen. The animation does not need to adhere strictly to the principles of physics, but it does need to retain some semblance of realism. The purpose is to provide 2-3 seconds of levity to an otherwise simple handwriting animation. In the end, the ball drops one step and dribbles to the slogan "Coding & Design," where it morphs into the dot above the letter i. I can handle that part - the ending. Here are the biggest issues, again placed in the simplest terms : 1) The ball always returns to the origin point, regardless of what I do (transformOrigin: "center center", endAtStart: fase, yoyo:false, or repeat = 0, etc...). I cannot resolve this issue for the life of me. The dot returns with the homing instincts of a carrier pigeon to its starting point. 2) Squash does not work for me. It hates me. The bounce effect works okay, but I cannot make the "squash-bounce" effect work for me when the dot collides with a letter. Adding squash can cause the animation to freak completely. I don't get it. 3) Timing is the big issue in a nutshell. I need the effects to hapen they should happen. Then, I need the dot to return to its original shape in between collisions. I have the same problems when I've added HTML paths and referenced them by id, and when I've not added any additional HTML. It seems like an important, but I still can't get where I need to go. I've come to Wit's End. I'm almost there. It's starting to feel like home. Please help if you can. I'm very grateful for any assistance. Robert-
- customease
- custombounce
-
(and 3 more)
Tagged with:
-
Note: This page was created for GSAP version 2. We have since released GSAP 3 with many improvements. While it is backward compatible with most GSAP 2 features, some parts may need to be updated to work properly. Please see the GSAP 3 release notes for details. Have you ever tried getting a realistic wiggle effect or tweaking just how bouncy an ease is? What about adding squash and stretch to a bounce? These are not easy tasks. Well, until now. Even though CustomEase, lets you create literally any easing effect that you can imagine (bounces, wiggles, elastic effects, whatever) by drawing them, it's difficult to plot a complex wiggle or bounce while making sure all the points are spaced correctly. Wouldn't it be nice if you could just set a few parameters (like number of wiggles or bounciness) and have that complex easing curve created for you? Wish granted. CustomWiggle CustomWiggle extends CustomEase (think of it like a wrapper that creates a CustomEase under the hood based on the variables you pass in), allowing you to not only set the number of wiggles, but also the type of wiggle (there are 5 types; see demo below). Advanced users can even alter the plotting of the wiggle curves along either axis using amplitudeEase and timingEase special properties (see the docs for details). Demo: CustomWiggle Types See the Pen CustomWiggle Demo : resized by GreenSock (@GreenSock) on CodePen. Options wiggles (Integer) - number of oscillations back and forth. Default: 10 type (String) "easeOut" | "easeInOut" | "anticipate" | "uniform" | "random" - the type (or style) of wiggle (see demo above). Default: "easeOut" amplitudeEase (Ease) - provides advanced control over the shape of the amplitude (y-axis in the ease visualizer). You define an ease that controls the amplitude's progress from 1 toward 0 over the course of the tween. Defining an amplitudeEase (or timingEase) will override the "type" (think of the 5 "types" as convenient presets for amplitudeEase and timingEase combinations). See the example codepen to play around and visualize how it works. timingEase (Ease) - provides advanced control over how the waves are plotted over time (x-axis in the ease visualizer). Defining an timingEase (or amplitudeEase) will override the "type" (think of the 5 "types" as convenient presets for amplitudeEase and timingEase combinations). See the example codepen to play around and visualize how it works. How do you control the strength of the wiggle (or how far it goes)? Simply by setting the tween property values themselves. For example, a wiggle to rotation:30 would be stronger than rotation:10. Remember, an ease just controls the ratio of movement toward whatever value you supply for each property in your tween. Sample code //Create a wiggle with 6 oscillations (default type:"easeOut") CustomWiggle.create("myWiggle", {wiggles:6}); //now use it in an ease. "rotation" will wiggle to 30 and back just as much in the opposite direction, ending where it began. TweenMax.to(".class", 2, {rotation:30, ease:"myWiggle"}); //Create a 10-wiggle anticipation ease: CustomWiggle.create("funWiggle", {wiggles:10, type:"anticipate"}); TweenMax.to(".class", 2, {rotation:30, ease:"funWiggle"}); Wiggling isn't just for "rotation"; you can use it for any property. For example, you could create a swarm effect by using just 2 randomized wiggle tweens on "x" and "y", as demonstrated here. CustomBounce GSAP always had the tried-and-true Bounce.easeOut, but there was no way to customize how "bouncy" it was, nor could you get a synchronized squash and stretch effect during the bounce because: The "bounce" ease needs to stick to the ground momentarily at the point of the bounce while the squashing occurs. Bounce.easeOut offers no such customization. There was no way to create the corresponding [synchronized] scaleX/scaleY ease for the squashing/stretching. CustomEase solves this now, but it'd still be very difficult to manually draw that ease with all the points lined up in the right spots to match up with the bounces. With CustomBounce, you can set a few parameters and it'll create BOTH CustomEases for you (one for the bounce, and one [optionally] for the squash/stretch). Again, think of CustomBounce like a wrapper that creates a CustomEase under the hood based on the variables you pass in. Options strength (Number) - a number between 0 and 1 that determines how "bouncy" the ease is, so 0.9 will have a lot more bounces than 0.3. Default: 0.7 endAtStart (Boolean) - if true, the ease will end back where it started, allowing you to get an effect like an object sitting on the ground, leaping into the air, and bouncing back down to a stop. Default: false squash (Number) - controls how long the squash should last (the gap between bounces, when it appears "stuck"). Typically 2 is a good number, but 4 (as an example) would make the squash longer in relation to the rest of the ease. Default: 0 squashID (String) - the ID that should be assigned to the squash ease. The default is whatever the ID of the bounce is plus "-squash" appended to the end. For example, CustomBounce.create("hop", {strength:0.6, squash:2}) would default to a squash ease ID of "hop-squash". How do you get the bounce and the squash/stretch to work together? You'd use two tweens; one for the position ("y"), and the other for the scaleX/scaleY, with both running at the same time: //Create a custom bounce ease: CustomBounce.create("myBounce", {strength:0.6, squash:3, squashID:"myBounce-squash"}); //do the bounce by affecting the "y" property. TweenMax.from(".class", 2, {y:-200, ease:"myBounce"}); //and do the squash/stretch at the same time: TweenMax.to(".class", 2, {scaleX:140, scaleY:60, ease:"myBounce-squash", transformOrigin:"center bottom"}); See the Pen CustomBounce from GreenSock by GreenSock (@GreenSock) on CodePen. Where can I get it? CustomWiggle and CustomBounce are membership benefits of Club GreenSock ("Shockingly Green" and "Business Green" levels). It's our way of saying "thanks" to those who support GreenSock's ongoing efforts. Joining Club GreenSock gets you a bunch of other bonus plugins and tools like MorphSVGPlugin as well, so check out greensock.com/club/ for details and sign up today.
-
Sunday night, I could be doing so many things other than breaking Jack's toys couldn't I? Well, I am that boring sometimes. Sorry Jack. So, the combo that caused the weirdness is CustomBounce + percentage base movement + transformOrigin in a shape element of an SVG. As you will see in the pen (at least in Chrome), the element gets moved to the 0,0 position according to the transformOrigin you define. Not something desirable if you're trying to squash an element.
- 2 replies
-
- custombounce
- svg
-
(and 1 more)
Tagged with: