phetsims / twixt

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

replace and delete MoveTo and OpacityTo #18

Closed pixelzoom closed 5 years ago

pixelzoom commented 6 years ago

MoveTo and OpacityTo are 2 wrappers around TWEEN. The idea was to insulate sims from the eventual replacement of TWEEN. Since we now have animation support in TWIXT (Animation, Easing, etc.) that replaces TWEEN, the time has come to rewrite MoveTo and OpacityTo.

Current usages:

MoveTo

OpacityTo

Since most of this is code that I'm responsible for, it would make sense for me to do this. @ariel-phet OK for me to proceed?

pixelzoom commented 6 years ago

Hmmm... Looking inside MoveTo and OpacityTo, there's not really much there. It might make more sense to replace uses of these with Animation, and then delete them.

pixelzoom commented 6 years ago

Yes, I think it's best to just replace uses of MoveTo and OpacityTo with Animation, and then delete them.

ariel-phet commented 6 years ago

Sounds good, sorry for the delay

pixelzoom commented 6 years ago

Good, because I'm about half done with this :)

pixelzoom commented 6 years ago

All uses of MoveTo and Opacity have been replaced with Animation, and MoveTo and OpacityTo have been deleted. All usages except one were in my sims.

Assigning to @jonathanolson to review the replacement in capacitor-lab-basics, to decide whether he'd like to use a different variation of the Animation options, and whether to use stepper: 'timer'. Feel free to close after that review.

pixelzoom commented 6 years ago

I just discovered the object and attribute options for animation targets, and I've used them in the above commits. For animating translation and opacity, this is much nicer than how I was previously using setValue and getValue options.

pixelzoom commented 5 years ago

Review of capacitor-lab-basics by @jonathanolson is moved to https://github.com/phetsims/capacitor-lab-basics/issues/252, so that this issue can be closed.

pixelzoom commented 5 years ago

There are a bunch of sims that are still preloading Tween via something like this in their package.json:

    "preload": [
      "../sherpa/lib/Tween-r12.js"
    ],

I've create sim-specific issues for each such sim.