Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
WhiteDesign

Is this a complete mess?

Recommended Posts

Hello again!!!!

 

Still being a bit of a novice I just wanted to run this code past you to make sure I'm not making a complete dogs breakfast of how I'm structuring my code or that I'm making things slow and clunky because of excess 'stuff'. The whole thing works brilliantly, I just to be sure I'm doing things properly!

 

Thanks!!!

Louisa :D

 

/////////////// Main Menu

TweenLite.to(info.myMenu_btn.myMenuButtons, 0, {autoAlpha:0});

info.myMenu_btn.addEventListener(MouseEvent.ROLL_OVER, mouseOverHandler);
info.myMenu_btn.addEventListener(MouseEvent.ROLL_OUT, mouseOutHandler);

function mouseOverHandler(e:Event):void {

TweenLite.to(info.myMenu_btn.myMenuButtons, 0.5, {autoAlpha:1});
}
function mouseOutHandler(e:Event):void {
TweenLite.to(info.myMenu_btn.myMenuButtons, 1, {autoAlpha:0});
}

////////////////////// Menu Buttons

	TweenMax.from(info.profile, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(info.otherInfo, 0, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenLite.to(info.panel, 0, {scrollRect:{left:0, right:913, top:0, bottom:516}});
	TweenMax.to(pageMenu, 0, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});

	info.myMenu_btn.myMenuButtons.profile_btn.addEventListener(MouseEvent.CLICK,playProfileInfo);
	function playProfileInfo(e:Event) 
{
	TweenMax.to(info.profile, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});
	TweenMax.to(info.otherInfo, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenLite.to(info.panel, 1, {scrollRect:{left:0, right:913, top:0, bottom:516}});
}
	info.myMenu_btn.myMenuButtons.more_btn.addEventListener(MouseEvent.CLICK,playMoreInfo);
	function playMoreInfo(e:Event) 
{
	TweenMax.to(info.profile, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(info.otherInfo, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});
	TweenLite.to(info.panel, 1, {scrollRect:{left:0, right:913, top:0, bottom:430}});

}

////////////// Close Panel	

	info.myMenu_btn.myMenuButtons.gallery_btn.addEventListener(MouseEvent.CLICK,closeProfile);
	function closeProfile(e:Event) 
{
	TweenMax.to(info, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(pageMenu, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});


}
	info.close.addEventListener(MouseEvent.CLICK,closeBtnProfile);
	function closeBtnProfile(e:Event) 
{
	TweenMax.to(info, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(pageMenu, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});
}

Link to comment
Share on other sites

I'm not a Tweenlite god or anything but your code looks fine to me... At least if it is a complete mess, my code is too :)

 

The only thing is I'm wondering why you're using TweenLite and TweenMax? I might be wrong but since you're already using TweenMax, the "damage is done" on the filesize so you could simply use it all the time for clarity... (also it saves one key press :lol: ) If that is because it conflicts with the one before, you could use the wonderfull TimelineLite to sequence you tweens (even if they're all having a time of 0).

 

Cheers

Link to comment
Share on other sites

Just to clarify, since TweenMax extends TweenLite, the total file size incurred by using TweenLite AND TweenMax together is exactly the same as if you only used TweenMax. But there is a small benefit to using TweenLite even if you use TweenMax elsewhere in your project - since there's less conditional logic in the rendering routines, TweenLite tweens can run SLIGHTLY faster than TweenMax tweens. You'd never notice unless you're tweening hundreds or thousands of tweens simultaneously, though, so it shouldn't be a major concern either way. Since I'm an efficiency freak, I tend to use TweenLite for all tweens that don't specifically require a TweenMax feature.

 

Speed test: http://blog.greensock.com/tweening-speed-test/

 

So yeah, using just TweenMax would be a bit more clear I suppose and there isn't a compelling reason to mix & match, but if you're a fellow efficiency freak, it's fine to do. :)

Link to comment
Share on other sites

Thanks!!!! :D

I use the tween examples as reference but I take them far too literally! I feel like I have to use the tweens as shown in the example (be it TweenLite or TweenMax) otherwise my Mac will explode!! :o

 

Louisa :)

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