Jump to content
Search Community

Easing With Variable Problem

Guest rhysyG
Moderator Tag

Recommended Posts

Hey Guys,

 

A weird one here, I want to use some different tweening functions, but I seem to get weird results when I try implement it.

There's a bit of code before this but basically this works completely fine:

 

TweenMax.fromTo(_root[currentMC], .5, {ease:Strong.easeIn}, {_y:bottom}, {_y:mid});

TweenMax.fromTo(_root[nextMC], .8, {ease:Strong.easeIn}, {_y:mid}, {_y:top});

 

But changing {ease:Strong.easeIn} to others like {ease:Bounce.easeIn} doesn't do anything?

 

When I use the tweening visualizer it has the syntax like this:

TweenLite.to(ball, 2, {y:0, ease:Elastic.easeInOut});

 

So the easing command after the x or y parameter.

However when I do this my animation script goes haywire!

 

Does anyone see anything wrong with what I'm doing?

 

Thanks!

 

 

 

ease:Elastic.easeInOut

Link to comment
Share on other sites

i don't know if this is the exact code from your file but there's a flaw in the slaw

 

TweenMax.fromTo(_root[currentMC], .5, {ease:Strong.easeIn}, {_y:bottom}, {_y:mid});

TweenMax.fromTo(_root[nextMC], .8, {ease:Strong.easeIn}, {_y:mid}, {_y:top});

 

 

 

this is how you would do it:

 

TweenMax.fromTo(_root[currentMC], .5, {_y:bottom}, {_y:mid, ease:Elastic.easeIn});
TweenMax.fromTo(_root[nextMC], .8, {_y:mid}, {_y:top, ease:Elastic.easeIn});

Link to comment
Share on other sites

Thanks for the reply Carl,

 

Yeah thats how I thought you would do it but every-time I do that it goes haywire!

 

Here's more code if you are able to solve this:

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.events.TweenEvent;


var currentMC:String = "mcHome";
var nextMC:String;
var nextNum:Number;
var currentNum:Number = 1;
var top:Number = -400;
var mid:Number = 220;
var bottom:Number = 1200;
var changeLinkVar:Number = 1;
changeLinks();

TweenMax.fromTo(_root[currentMC], 1, {ease:Strong.easeIn}, {_y:mid}, {_y:bottom});


function shuffleMC(nextNum)
{
trace("currentMC" + currentMC);
trace("currentNum" + currentNum);
trace("nextMC" + nextMC);
trace("nextNum" + nextNum);


if((TweenMax.isTweening(_root[currentMC]) == false) || (TweenMax.isTweening(_root[nextMC]) == false))
{


	switch (nextNum) { 
	 case 1 : 
	 nextMC = "mcHome";
	 break; 
	 case 2 : 
	 nextMC = "mcWork";
	 break; 
	 case 3 : 
	 nextMC = "mcWho";
	 break;
	 case 4 : 
	 nextMC = "mcContact";
	 break;
	 default : 
	 trace("some other month"); 
	}

	if(nextNum < currentNum)
	{
		changeLinks();
		trace("slide down");
		trace("____________________________");
		_root[nextMC]._y = top;
		TweenMax.fromTo(_root[currentMC], .5, {ease:Strong.easeIn}, {_y:bottom}, {_y:mid});
		TweenMax.fromTo(_root[nextMC], .8, {ease:Strong.easeIn}, {_y:mid}, {_y:top});

	}

	else if (nextNum > currentNum)
	{
		trace("slide up");
		trace("____________________________");
		_root[nextMC]._y = bottom;
		TweenMax.fromTo(_root[nextMC], .8, {ease:Strong.easeIn}, {_y:mid}, {_y:bottom});
		TweenMax.fromTo(_root[currentMC], .5, {ease:Strong.easeIn}, {_y:top}, {_y:mid});
	}

	currentMC = nextMC;
	currentNum = nextNum;
}
}

 

Then on the button I have this:

 

navWho.onPress = function(){

_root.nextNum = 3;

_root.shuffleMC(_root.nextNum);

}

 

So it's basically Nav like the firstborn website.

 

But doing this kills my code:

TweenMax.fromTo(_root[currentMC], .5, {_y:bottom}, {_y:mid, ease:Elastic.easeIn});

TweenMax.fromTo(_root[nextMC], .8, {_y:mid}, {_y:top, ease:Elastic.easeIn});

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