Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to do a certain animation with actionscript

Status
Not open for further replies.

krigbert

Programmer
Jun 2, 2005
95
NO
The effect I'm trying to get is something along the lines of the effect on this site: (click the [+])

I'm using this code
Code:
_global.abneLukke = function(){
	if (teppeoppe._height>=200) {gotoAndStop(goto);}
	
	if (abne=='pres') {
		
		if (teppeoppe._height<=150){h=1600;}
		teppenede._height -= (1/teppenede._height)*(600+h);
		teppeoppe._height -= (1/teppenede._height)*(600+h);
		coverings._alpha -= (0+coverings._alpha)/40;
	}
	
		if (teppenede._height<=40){teppenede._alpha=0;teppeoppe._alpha=0;}	
		if (teppeoppe._height<=41){teppenede._alpha=0;teppeoppe._alpha=0;}
	
	if (abne=='go'){
		teppenede._alpha=100;teppeoppe._alpha=100;
		if (teppeoppe._height>=150) {h = -200;}
		if (stopp==0){
		  teppenede._height += (teppenede._height+(600+h))/200;
		  teppeoppe._height += (teppenede._height+(600+h))/200;
		  if(coverings._alpha<100){coverings._alpha+=1+(coverings._alpha/30);}
		  if (teppeoppe._height>=265){stopp = 1;}
		}
	}
};

teoppeoppe and teppenede are two black rectangles. Here's how it works:
As you can see, it sometimes works quite well - but sometimes, it it doesn't quite open all the way up or you simply don't get the deceleration effect on the way down.

Help :l

illustration and webdesign
 
Second time I hear that - I guess it's true. I don't quite understand the tween class, though - so I'll just make a frame by frame animation for now.

illustration and webdesign
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top