Jump to content
Search Community

Bending object as its animated along bezier path?

wcomp test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Is there any way to "bend" an SVG object as its being animated along a bezier path using GSAP?  Something like this: https://www.behance.net/gallery/49401667/Twisted-letters-2 (the one with the blue pencil). I have managed to get the red arrow to animate along the path but the shape stays the same the whole time. Id like for it to follow along the green path and bend as it goes around the curve so that at the end of the animation it has the shape of the purple arrow:

See the Pen bOQBzZ?editors=0110 by Wcomp (@Wcomp) on CodePen

 

Is this possible with GSAP? I have experimented with the autoRotate feature but don't think that is going to get me all the way to where I want to go. Plus the arrow flys off the screen instead of staying next to the green line: https://codepen.io/Wcomp/pen/BvGpoe?editors=0110 Appreciate any help!

 

See the Pen bOQBzZ?editors=0110 by Wcomp (@Wcomp) on CodePen

Link to comment
Share on other sites

Hi,

 

Honestly I don't know how that can be done with just GSAP. Perhaps using ThreeJS and GSAP but I know nothing about ThreeJS.

 

What I can tell you is that this particular letter:

 

0a9b7349401667.58bd4bdc71063.gif

 

Was handed to my by a client as a PNG sequence. It is used in Streammm which is a native App. I worked on the front end that uses GSAP and PIXI, so my first guess is that this could be made using a 3D rendering software or engine.

 

Here  is the map used to create the animation in PIXI:

 

dOaJQ9N.gif

 

I'll ask my client about the origin of the image and let you know just in case. Sorry that I can't help you beyond this.

 

Happy Tweening!!!

  • Like 3
Link to comment
Share on other sites

Interesting. I was looking at Blender as a possible solution. I've almost got what I needed using the "Pattern along Path" effect in Inkscape and the MorphSVG plugin. Although I'm having some issues with odd morphing behavior. I'll probably post about that soon. Thanks!

  • Like 1
Link to comment
Share on other sites

You might be able to segment the tail of your arrow up into several paths that each autoRotate on their own to achieve something similar. It'll probably take a lot of trial and error with some other properties to get where you'd need, though, and may be tough to get the curve as smooth and your illustrated sample. 

Think on these lines:

https://codepen.io/lukasoe/pen/YNEoQR

https://codepen.io/pmk/pen/YPdJax

 

Otherwise, you could do several morphs, or a sprite map as mentioned above. Here's a sample of a sprite animation that I created just using GSAP's stepped ease.

See the Pen XBroJG by elegantseagulls (@elegantseagulls) on CodePen

 

  • Like 4
Link to comment
Share on other sites

Thanks! Those codepens look amazing. Some great ideas. I managed to get it working using an extremely tedious process of creating  nearly 40 different paths using Inkscape's "patten along path" function (to use like animation frames)  and then morphing them using morphSVG plugin. It works but its not as precise as I had hoped. I'm thinking I'm gonna check out the sprite option. Thanks for the response!

Link to comment
Share on other sites

@wcomp - if you're already making 40 paths, you'd be better off building the sprite than morphing that many. You can do the sprite in SVG too, since you are using Inkscape already. If it were me, I'd use the viewBox to hide the off-screen sprites. Just remember, for smooth animations, you'll want to be close to 60 fps (down to 30 would be acceptable too). So you'd end up with an SVG looking like:

 

 

<svg viewBox="0 0 100 100">
	<g class="transformMe">
		<path />
  		<path />
  		<path />
  		<!-- ...etc. Each, in this instance would be 100 units appart -->
	</g>
</svg>

 

and your GSAP looking like:
 

TweenMax.to('.transformMe', .5, { 
  x: -2900, // if you had 30 sprites (100 * (30 - 1))
  ease:  SteppedEase.config(29) // 29 steps cause first one is already in view
})

 

  • Like 3
Link to comment
Share on other sites

On 1/17/2019 at 2:41 AM, OSUblake said:

Hi @wcomp

 

You may want to try pop.svg. 

https://github.com/ste-vg/pop.svg

 

See the Pen jemxeV by ste-vg (@ste-vg) on CodePen

 

 

That's very cool, a tad over my head though at this point. Lol. And I cant't seem to find much documentation on it. I'll keep messing with it until I have it figured out. Thanks! 

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

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...