Jump to content
Search Community

Motionpath

abk test
Moderator Tag

Recommended Posts

Hi,

 

I'm using LinePath2D for an animation sequence. The path extends beyond the frame and so on 'progress:1' the elements go out of the frame. I want this animation to loop and so need to take the elements back to 'progrss:0' position. But while going back I want the elemnets to be invisible. I've used 'visible:false' and also 'alpha:0'. But the elements are still visible when they animate back to 'progress:0' position.

 

What should I do to make them invisible during their transit to the starting position of the path?

 

Thanks in advance,

abk

Link to comment
Share on other sites

if you store all of your elements that are on your path in an array, you can just do a TweenMax.allTo on them.

 

if you rip the code directly out of the LinePath2D docs you can just add

TweenMax.allTo(boxes, 0, {alpha:0});

 

if you do not have an array of all the elements on the path, there is a round about approach.

each path has a followers property. followers is an array of PathFollowers. each PathFollower has a target (the display object that is moving along the path).

 

so you could loop through your path's follwers array and place each PathFollower's target into an array sort of like:

 


// custom code to target all of the PathFollwers
//create an array to store all of the PathFollower Targets:


var arrayOfPathFollowerTargets:Array = [];

//loop through the path.followers (an array of PathFollowers);
//each PathFollower has a target
//push each target into the array created above


for (var f:int = 0; f < path.followers.length; f++)
{
arrayOfPathFollowerTargets.push( path.followers[f].target);
}
//tween all of the path follower targets;
TweenMax.allTo(arrayOfPathFollowerTargets, 1, {rotation:360, repeat:-1, yoyo:true

 

but it is much easier if you just create an array of your objects prior to having them controlled by a LinePath2D

  • Like 1
Link to comment
Share on other sites

  • 2 weeks 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...