Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
benoit

move along a path from x % of this path

Recommended Posts

Hi,

 

I know how to move a element along a path but how to add another element at 50% of this path (and do the same loop).
1/ create another path with a split point in svg software ?
2/ make a array manipulation on bezier variable ?
3/ deal with timeline ?

4/ or there is another option ?

See the Pen xYXywO?editors=1111 by benoitwimart (@benoitwimart) on CodePen

Link to comment
Share on other sites

Those are excellent suggestions from @Sahil

 

If you want full control over the timing and ease of playing through a segment of a path animation you can put your animations in a TimlineMax and use tweenFromTo() like: 

 

var black = new TimelineMax()
black.to("#black", 5, {
  bezier: { values: bezier, type: "cubic" },
  ease: "linear"
});


var red = new TimelineMax()
red.to("#red", 5, {
  bezier: { values: bezier, type: "cubic" },
  ease: "linear"
})

//tweenFromTo(startTimeOrLabel, endTimeOrLabel, {vars})
red.tweenFromTo(red.duration() * 0.5, 0, {repeat:-1, yoyo:true, repeatDelay:0.2, ease:Power2.easeInOut});

black.tweenFromTo(black.duration() * 0.5, black.duration(), {repeat:-1, yoyo:true, repeatDelay:0.2, ease:Power2.easeInOut});

 

See the Pen LQrrYm?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Read TimelineMax.tweenFromTo() docs

  • Like 4
  • Thanks 1
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.
×