Fixup updateConfig, add tests

Authored by skevy on Aug 10 2017, 12:37 PM.

Description

Fixup updateConfig, add tests

Summary:
As mentioned in D3299, we had some weird flaws in updateConfig.

Essentially what this diff accomplishes is keeping the spring dynamics correct depending on what param is changed in the update.

E.g.:

  • A spring is initially configured to go from 50 - 100, with an initial velocity of 0.
  • Sometime during the animation, spring.updateConfig({ toValue: 200 }) is called.
  • Even though updateConfig restarts the animation, the spring should continue from where it left off (the position before updateConfig is called), and start with an initial velocity equivalent to the velocity in which the spring was traveling before updateConfig.

There are tests included here to prove this behavior. I added some other tests as well here to round out some of the coverage.

Also, I'm doing a driveby and adding removeListener and removeAllListeners...as this is something that's needed.

Test Plan: Run the tests!

Reviewers: appsforartists

Reviewed By: appsforartists

Differential Revision: http://codereview.cc/D3300

Details

Committed
skevyAug 10 2017, 1:09 PM
Reviewer
appsforartists
Differential Revision
D3300: Fixup updateConfig, add tests
Parents
R51:7e7569436907: Made comments consistent across .js and .d.ts
Branches
Unknown
Tags
Unknown