Jump to content
Search Community

Boolean value on reverse not changing properly

AsKadir test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Hi all,
I have extensive code, so I took only the issue part.

There is a boolean value in my code, and I'm changing it in a timeline that I can then reverse.

The value is changing, but if you open a console and open an object, you'll see it isn't.

My question is, am I doing something wrong?
Can you help me, please?
 

Dock 2022-02-10 14-10-10.jpg

See the Pen VwrbKOe by ChicagoJostik (@ChicagoJostik) on CodePen

Link to comment
Share on other sites

  • Solution

It's working correctly. When you open the object, it's going to show the current value, not what it was at the time it logged it out. That has nothing to do with GSAP, it's just how objects work by reference in JavaScript. 

 

You can test it out yourself.

 

let obj = {
  value: false
};

console.log(obj);
obj.value = true;
console.log(obj)

 

If you need to log the actual value, it's best to just not do the object part.

console.log(mat.uniforms.myBool.value)

 

  • Like 2
  • Thanks 1
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...