Jump to content
Search Community

Set an element at a position along SVG path

Five&Done 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

I am wondering if there is an easier way to set an object at a particular point bezier and keep it there. I have this working through the following code but it seems like a hack. Thanks for any help!

 

var tl = new TimelineMax({});
    tl.add( TweenMax.to("#markerStart", 1, {bezier:{values:motionPath, type:"cubic"}}));
    tl.pause();
    tl.seek(0.001);

Link to comment
Share on other sites

Are you asking how to move your element to the start of a path? If so, you're looking at the answer. A motion path is an array of points, with the first item being the start position.

 

var start = motionPath[0];

TweenLite.set("#markerStart", {
  x: start.x,
  y: start.y
});

 

 

 

  • Like 4
Link to comment
Share on other sites

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