Jump to content
Search Community

Strange alpha

Luigi Vercotti test
Moderator Tag

Recommended Posts

Hello

Do you have an idea why the array pics goes from alpha:0 to alpha:1 which I wish to work like that by the way. But I found out I have to code it opposite from 1 to 0. What am I missing, please?

 

TweenMax.allTo([boxesLight.boxesLightPic01,boxesLight.boxesLightPic02,boxesLight.boxesLightPic03,boxesLight.boxesLightPic04], 0, {alpha:1});

var timeline:TimelineLite = new TimelineLite();
var boxesLightPictures:Array=[boxesLight.boxesLightPic01,boxesLight.boxesLightPic02,boxesLight.boxesLightPic03,boxesLight.boxesLightPic04];
/*var i:Number=boxesLightPictures.length;
while (i--) {
timeline.insert(TweenMax.from(boxesLightPictures[i],2,{alpha:0}),i*0.1);
}*/

for (var i=0; i	timeline.insert(TweenMax.from(boxesLightPictures[i],3,{alpha:0}),i*0.1);
}

Link to comment
Share on other sites

your code works as expected. doing the following may be more intuitive:

 

//set all boxes to have alpha of 0 immediately

TweenMax.allTo([boxesLight.boxesLightPic01,boxesLight.boxesLightPic02,boxesLight.boxesLightPic03,boxesLight.boxesLightPic04], 0, {alpha:0});

 

var timeline:TimelineLite = new TimelineLite();

var boxesLightPictures:Array=[boxesLight.boxesLightPic01,boxesLight.boxesLightPic02,boxesLight.boxesLightPic03,boxesLight.boxesLightPic04];

 

//tween all boxes to alpha 1

for (var i=0; i

timeline.insert(TweenMax.to(boxesLightPictures,3,{alpha:1}),i*0.1);

}

 

 

------------------

 

when using a from tween it is important that your objects that you are tweening appear in the state that you want the from tween to end.

so in the code you provided you were setting the alpha TO 1 so you could tween FROM 0.

 

 

in your code, if the boxes already had an alpha of 1, your first tween

 

TweenMax.allTo([boxesLight.boxesLightPic01,boxesLight.boxesLightPic02,boxesLight.boxesLightPic03,boxesLight.boxesLightPic04], 0, {alpha:1});

 

would be unnecessary

 

 

--------

 

my code tweens all obejcts TO alpha 0 and then Tweens them all TO alpha 1

 

----

 

if you need more clarity just let me know.

 

Carl

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