Jump to content
Search Community

Tweening 'binary' properties?

ladlon
Moderator Tag

Recommended Posts

Posted

I'm curious... What happens when you try and tween a 'binary' property, such as 'Visibility'?

 

Does it remain at the initial state until the duration is complete, and then switch to the new value?  It obviously can't 'tween/fade' to it, so I'm curious how GSAP treats such a thing.

Posted

Create a test and find out.

var div = document.querySelector("div")
var style = getComputedStyle(div)

console.log(style.visibility)

gsap.to(div, {
  visibility: "hidden",
  onUpdate() {
    console.log(style.visibility)
  }
})

 

  • Like 4
Posted

Yeah, it generally sets the (new) value right away except for "display: none" which it'll do at the end because it would be very odd to have that set initially. 

  • Like 2

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