Skip to main content
August 2, 2006
Answered

custom easing code in class file?

here is the code i get from the custom easing tool:

customEasing = {};
customEasing.pts = [0,0.0257,0.0609,0.1057,0.1603,0.2247,0.2991,0.3837, ect.. ect...
customEasing.ease = function(t,b,c,d,pl){
return b+c*pl[Math.round(t/d * pl.length)];
}

however i need this code to go into a class defenition which extends movie clip. but there seems to be no easy way to do this as the way the above code is set out is not allowd in a class defenition. so my question is how can i rearange this code to work in a class defenition so that other methods of that class can use it in tweens?
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
August 2, 2006
it's ok i finaly cracked it. i just put the custom ease code in the function that contains the tweens and chenged the way the customEase object is declared:

private var customEasing:Object;

(contructor function here)

public function AnimIn(){
customEasing = {};
customEasing.pts = [0,0.0257,0.0609,0.1057,0.1603,0.2247,0.2991 ect.. ect..
customEasing.ease = function(t,b,c,d,pl){
return b+c*pl[Math.round(t/d * pl.length)];
}


// from 8.3 to -7.8 = 16.1
news_mc.tween("_y", news_mc._y - 16.1, 1, customEasing, 0);
about_mc.tween("_y", about_mc._y - 16.1, 1, customEasing, 0.25);
photog_mc.tween("_y", photog_mc._y - 16.1, 1, customEasing, 0.5);
design_mc.tween("_y", design_mc._y - 16.1, 1, customEasing, 0.75);
store_mc.tween("_y", store_mc._y - 16.1, 1, customEasing, 1);
contact_mc.tween("_y", contact_mc._y - 16.1, 1, customEasing, 1.25);
links_mc.tween("_y", news_mc._y - 16.1, 1, customEasing, 1.5);
}

1 reply

Correct answer
August 2, 2006
it's ok i finaly cracked it. i just put the custom ease code in the function that contains the tweens and chenged the way the customEase object is declared:

private var customEasing:Object;

(contructor function here)

public function AnimIn(){
customEasing = {};
customEasing.pts = [0,0.0257,0.0609,0.1057,0.1603,0.2247,0.2991 ect.. ect..
customEasing.ease = function(t,b,c,d,pl){
return b+c*pl[Math.round(t/d * pl.length)];
}


// from 8.3 to -7.8 = 16.1
news_mc.tween("_y", news_mc._y - 16.1, 1, customEasing, 0);
about_mc.tween("_y", about_mc._y - 16.1, 1, customEasing, 0.25);
photog_mc.tween("_y", photog_mc._y - 16.1, 1, customEasing, 0.5);
design_mc.tween("_y", design_mc._y - 16.1, 1, customEasing, 0.75);
store_mc.tween("_y", store_mc._y - 16.1, 1, customEasing, 1);
contact_mc.tween("_y", contact_mc._y - 16.1, 1, customEasing, 1.25);
links_mc.tween("_y", news_mc._y - 16.1, 1, customEasing, 1.5);
}
Translate