Jump to content
Search Community

opacity or alpha

Thomas James Thorstensson test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello!

 

 

I know the difference between opactiy and autoAlpha:

 

But what is the difference between opacity and alpha?

 

Yes I realise that opacity is a css property:

 

But if you use alpha on a dom object what is the difference to using opacity?

 

I am sure this is a really dumb question, I must have missed something.

 

 

 

Thankful for reply, Snoop out,

.S

  • Like 1
Link to comment
Share on other sites

Not a dumb question - alpha is simply an alias for opacity. No difference whatsoever. It was added originally to help consistency with the Flash API (Flash always used "alpha"). There were a lot of GSAP users coming from the Flash world at the time :) 

Link to comment
Share on other sites

Not a dumb question - alpha is simply an alias for opacity. No difference whatsoever. It was added originally to help consistency with the Flash API (Flash always used "alpha"). There were a lot of GSAP users coming from the Flash world at the time :)

 

Me included among those folks as I have a well thumbed copy of 'HTML5 for Flash developers' . Great to know, one less gray hair today  B)

 

Thanks

 

.S

Link to comment
Share on other sites

I'm not sure I'd say "best" in every case, but yes, autoAlpha has the added benefit of toggling visibility when it makes sense. There's a very slight performance hit during the tween due to the fact that it has to control that additional property but it's pretty negligible. From a rendering standpoint, it is definitely cheaper for the browser if visibility is set to hidden. 

Link to comment
Share on other sites

  • 2 months later...

I was about to post the same question as Snoop.  The RGBA acronym and CSS3 property of the same name

defines the acronym as Red, Green, Blue, and Alpha.  Where alpha channel is also called the opacity channel.

 

I kept seeing the term autoAlpha in the GreenSock ActionScript API Docs and I am glad I found this discussion.

Link to comment
Share on other sites

Hello KerryRuddock

 

autoAlpha is part of the GSAP CSSPlugin for GSAP JS:

 

http://greensock.com/docs/#/HTML5/GSAP/Plugins/CSSPlugin/

  • autoAlpha
    Identical to opacity except that when the value hits 0 the visibility property will be set to "hidden" in order to improve browser rendering performance and prevent clicks/interactivity on the target. When the value is anything other than 0, visibility will be set to "inherit". It is not set to "visible" in order to honor inheritance (imagine the parent element is hidden - setting the child to visible explicitly would cause it to appear when that's probably not what was intended). And for convenience, if the element's visibility is initially set to "hidden" and opacity is 1, it will assume opacity should also start at 0. This makes it simple to start things out on your page as invisible (set your css visibility:hidden) and then fade them in whenever you want.
Example of usage:
//fade out and set visibility:hidden and opacity to 0
TweenLite.to(element, 2, {autoAlpha:0});

//in 2 seconds, fade back in with visibility:visible and opacity to 1
TweenLite.to(element, 2, {autoAlpha:1, delay:2});

:)

  • Like 4
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...