phetsims / twixt

Animation library for interactive HTML5 graphics
MIT License
1 stars 3 forks source link

Bounds for Transition/TransitionNode #15

Closed samreid closed 6 years ago

samreid commented 6 years ago

https://github.com/phetsims/twixt/issues/11#issuecomment-383658578

I tried changing createSomething to:

    function createSomething() {
      return new HSlider(new Property(0),{min:-10,max:10},{
        center: bounds.center
      });
    }

And saw unexpected behavior for all the transitions except dissolve. Am I supposed to embed the content in something that has exactly the same bounds as given to the TransitionNode?

samreid commented 6 years ago

@jonathanolson replied:

It would be good to discuss this situation. The current behavior assumes that it can completely change the transform of what is passed in, so it immediately wipes away the centering that was done. This could be solvable by always wrapping every content node (or having an option to do so).

Thoughts?

samreid commented 6 years ago

I didn't understand why the assumption that it could completely change the transform of what is passed in failed for the example in: https://github.com/phetsims/twixt/issues/15#issue-317467128

It should be OK for the TransitionNode to assume it can completely change the location of the HSlider that was passed in, but I didn't understand why it flickered. Or why the flicker might go away if I wrap the HSlider in another Node.

jonathanolson commented 6 years ago

I'm curious about the flickering, so it would be helpful to see a full example where this is the case (so I could explain what's going on).

jonathanolson commented 6 years ago

Implemented a bounds improvement to prevent the "flicker" above.