Jump to content
Search Community

How to toggle alpha when a button is clicked

fs_tigre test
Moderator Tag

Go to solution Solved by OSUblake,

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

Hi,

 

Is it possible to check the current alpha of an element in GSAP?

 

In other words I have a button that when clicked it changes the alpha of an element to .5 and I would like to be able to toggle the alpha from 1 to .5.

 

Something like...

function clickEvent{
 if(alpha == .5){
   TweenLite.to(".someElement", 1, {alpha: 1});
 }else{
  TweenLite.to(".someElement", 1, {alpha: .5});
  
 }
}

How is this typically done? Does GSAP has some property to check the opacity of an element or it needs to be done in pure Javascript?

 

Thanks a lot.

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