Jump to content
Search Community

bezierThrough timelineMax

fatBannerPaul test
Moderator Tag

Recommended Posts

Hi all, i'm sure i've missed something really simple but... i can't for the live of me get my bezierThrough sequence working properly inside an instance of timelineMax, would a bezierThrough wiz mind taking a look please?

 

i'll just explain a bit,

i have some mc's (plots) on my stage and these are being used to create the bezierThrough x and y's so, run a for loop over them, store their positions in an array then remove them

 

once that's done start the ad,

i think i've set up the TweenMax stuff wrong in the time line as i'm unable to access it's current progress and my sliderBg bar thing doesn't move or show any timeline progress,

 

import com.greensock.*;

import com.greensock.easing.*;

 

var amntOfPlots = 11;

var plotArray:Array = new Array();

var masterEnterFrame = this.createEmptyMovieClip(this, this.getNextHighestDepth());

 

function init() {

for (i=0; i

var plot:MovieClip = eval("plot"+i);

plotArray.push([plot._x, plot._y]);

plot.swapDepths(_root.getNextHighestDepth());

plot.removeMovieClip();

}

if (i>=amntOfPlots) {

startAd();

}

}

 

 

 

var targetClipTimeline:TimelineMax = new TimelineMax({onComplete:timelineEnded});

 

function startAd(){

targetClipTimeline.appendMultiple(

[

new TweenMax.to(targetClip,10,{bezierThrough:[

{_x:plotArray[0][0], _y:plotArray[0][1]},

{_x:plotArray[1][0], _y:plotArray[1][1]},

{_x:plotArray[2][0], _y:plotArray[2][1]},

{_x:plotArray[3][0], _y:plotArray[3][1]},

{_x:plotArray[4][0], _y:plotArray[4][1]},

{_x:plotArray[5][0], _y:plotArray[5][1]},

{_x:plotArray[6][0], _y:plotArray[6][1]},

{_x:plotArray[7][0], _y:plotArray[7][1]},

{_x:plotArray[8][0], _y:plotArray[8][1]},

{_x:plotArray[9][0], _y:plotArray[9][1]},

{_x:plotArray[10][0], _y:plotArray[10][1]}],orientToBezier:false}),

 

new TweenMax.to(targetClip, 2,{_xscale:30, _yscale:30, _rotation:10, delay:8})

 

],0.0, TweenAlign.NORMAL, 0.0);

}

 

function timelineEnded(){

//

}

 

 

masterEnterFrame.onEnterFrame = function() {

sliderBg.silderBtn._x = targetClipTimeline.currentProgress*400

};

 

init();

Link to comment
Share on other sites

wow, you really had me puzzled for a bit. your code looked really good.

 

I found with a few traces that your timeline had a duration of 0 seconds and it would complete instantly (put a trace in the complete function)... yet the animation played fine?

 

it seems the TweenMax tweens were playing instantly upon their creation and they were never really added to the timeline. by pausing your timeline at first, removing the new from new TweenMax and adding a play() it seems to work great.

 

paste all this code into main

 

import com.greensock.*;
import com.greensock.easing.*;

var amntOfPlots = 11;
var plotArray:Array = new Array();
var masterEnterFrame = this.createEmptyMovieClip(this, this.getNextHighestDepth());

function init() {
for (i=0; i		var plot:MovieClip = eval("plot"+i);
	plotArray.push([plot._x, plot._y]);
	plot.swapDepths(_root.getNextHighestDepth());
	plot.removeMovieClip();
}
if (i>=amntOfPlots) {
	startAd();
}
}


//pause the timeline in the constructor
var targetClipTimeline:TimelineMax = new TimelineMax({onComplete:timelineEnded, paused:true, timeScale:1});

function startAd(){

trace("startAd");
targetClipTimeline.appendMultiple(
							[ 


							//remove "new" keyword from new TweenMax... apparently this made the tween run before it was appended to the timeline 

							TweenMax.to(targetClip,10,{bezierThrough:[
										 {_x:plotArray[0][0], _y:plotArray[0][1]},
										 {_x:plotArray[1][0], _y:plotArray[1][1]},
										 {_x:plotArray[2][0], _y:plotArray[2][1]},
										 {_x:plotArray[3][0], _y:plotArray[3][1]},
										 {_x:plotArray[4][0], _y:plotArray[4][1]},
										 {_x:plotArray[5][0], _y:plotArray[5][1]},
										 {_x:plotArray[6][0], _y:plotArray[6][1]},
										 {_x:plotArray[7][0], _y:plotArray[7][1]},
										 {_x:plotArray[8][0], _y:plotArray[8][1]},
										 {_x:plotArray[9][0], _y:plotArray[9][1]},
										 {_x:plotArray[10][0], _y:plotArray[10][1]}],orientToBezier:false}),

							TweenMax.to(targetClip, 2,{_xscale:30, _yscale:30, _rotation:10, delay:8})

							],.0, TweenAlign.NORMAL, .0);				
//play the timeline after it is fully built
targetClipTimeline.play();

}

function timelineEnded(){
trace("done");
}


masterEnterFrame.onEnterFrame = function() {
trace(targetClipTimeline.currentProgress)
sliderBg.silderBtn._x = targetClipTimeline.currentProgress*400
};

init();

Link to comment
Share on other sites

Hey Carl, that's fantastic, thanks ever so much for looking into for me!

 

now that you got that bit working i added an ease to the entire timeline and should now be able to compete my project ;)

 

Thanks again!!

 

Paulie!

 

import com.greensock.*;

import com.greensock.easing.*;

 

var amntOfPlots = 11;

var plotArray:Array = new Array();

var masterEnterFrame = this.createEmptyMovieClip(this, this.getNextHighestDepth());

 

//apply ease type to the entire timeline

var easeType = Sine.easeInOut;

 

function init() {

for (i=0; i

var plot:MovieClip = eval("plot"+i);

plotArray.push([plot._x, plot._y]);

plot.swapDepths(_root.getNextHighestDepth());

plot.removeMovieClip();

}

if (i>=amntOfPlots) {

startAd();

}

}

 

 

//pause the timeline in the constructor

var targetClipTimeline:TimelineMax = new TimelineMax({onComplete:timelineEnded, paused:true, timeScale:1});

 

function startAd(){

 

// trace("startAd");

targetClipTimeline.appendMultiple(

[

 

 

//remove "new" keyword from new TweenMax... apparently this made the tween run before it was appended to the timeline

 

TweenMax.to(targetClip,10,{bezierThrough:[

{_x:plotArray[0][0], _y:plotArray[0][1]},

{_x:plotArray[1][0], _y:plotArray[1][1]},

{_x:plotArray[2][0], _y:plotArray[2][1]},

{_x:plotArray[3][0], _y:plotArray[3][1]},

{_x:plotArray[4][0], _y:plotArray[4][1]},

{_x:plotArray[5][0], _y:plotArray[5][1]},

{_x:plotArray[6][0], _y:plotArray[6][1]},

{_x:plotArray[7][0], _y:plotArray[7][1]},

{_x:plotArray[8][0], _y:plotArray[8][1]},

{_x:plotArray[9][0], _y:plotArray[9][1]},

{_x:plotArray[10][0], _y:plotArray[10][1]}],orientToBezier:false}),

 

TweenMax.to(targetClip, 2,{_xscale:30, _yscale:30, _rotation:10, delay:8})

 

],.0, TweenAlign.NORMAL, .0);

//play the timeline after it is fully built

targetClipTimeline.play();

 

//apply an ease to the entire timeline!

TweenMax.to(targetClipTimeline, 10, {currentProgress:1, ease:easeType});

 

}

 

function timelineEnded(){

//trace("done");

}

 

 

masterEnterFrame.onEnterFrame = function() {

// trace(targetClipTimeline.currentProgress)

sliderBg.silderBtn._x = targetClipTimeline.currentProgress*400

};

 

init();

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