Jump to content
GreenSock

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

autoalpha problem

Recommended Posts

as we all konw,autoalpha can tween alpha and visible.i have code as follows

 

import com.greensock.TweenMax;

import com.greensock.easing.*;

mc.visible=false

mc.alpha=0

TweenMax.from(mc, 1, {autoAlpha:0,y:400})

 

but seems not work.if i remove mc.visible=false

mc.alpha=0 it works and tween alpha from 0 to 1

if i use tweenmax.to function it works well .

Link to comment
Share on other sites

Hi Teki. Welcome to the GreenSock Forums.

 

You are experiencing the expected behavior. Let me explain. When using a from() tween, you the developer are specifying the values you want your tween to start at.

 

TweenLite/Max use the objects current values as the ending values for the tween.

 

If an object has an x of 0, and you say TweenFrom -100. Well, the object will move FROM x:-100 (start vaiue) TO x:0 (end value).

 

 

When you put

 

 

mc.visible=false

mc.alpha=0

 

into your code, you were setting the end values the same as your start values.

 

if an object has alpha 0, and you tween from alpha:0, there is no change in value.

 

What you want to do is just this

 

TweenMax.from(mc, 1, {autoAlpha:0})

 

or

 

mc.alpha = 0;
mc.visible = false;
TweenMax.to(mc, 1, {autoAlpha:1});

 

 

 

If you need more help let use know.

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