-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for interpolation precision; change spring() format
This changes the format of `spring(val, [stiffness, damping])` to `spring(val, {stiffness, damping, onRest, precision})`. Docs of this breaking change coming soon, but tldr: second argument now an object (still optional). `{stiffness: 120, damping: 12}` is clearer than the previous `[120, 12]`. onRest is for the future end callback (name subject to change, no implementation yet). Precision is the rounding of interpolating value. All alltributes are optionals and have sensible defaults. More on precision: #100. We don't actually round the numbers; just a check on whether the destination delta and speed is smaller than a certain threshold. Rounding the number during interpolation _might not_ be very useful. The main concern is that we can optimize by not rendering, when the number's so small that it doesn't change. But I'm not sure the probability of every (rounded) value in `style` not changing, at any frame, compared to the last, is high enough to justify the overhead of checking it every frame. We'll see.
- Loading branch information
Showing
10 changed files
with
59 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
/* @flow */ | ||
// [stiffness, damping] | ||
export default { | ||
noWobble: [170, 26], // the default | ||
gentle: [120, 14], | ||
wobbly: [180, 12], | ||
stiff: [210, 20], | ||
noWobble: {stiffness: 170, damping: 26}, // the default | ||
gentle: {stiffness: 120, damping: 14}, | ||
wobbly: {stiffness: 180, damping: 12}, | ||
stiff: {stiffness: 210, damping: 20}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1be045c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👏