This repository has been archived by the owner on May 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a helper for constructing spring config values that match up with the Origami design prototyping tool. http://facebook.github.io/origami/
- Loading branch information
1 parent
a0c164e
commit 416361f
Showing
3 changed files
with
48 additions
and
7 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
25 changes: 25 additions & 0 deletions
25
rebound-core/src/main/java/com/facebook/rebound/OrigamiValueConverter.java
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.facebook.rebound; | ||
|
||
/** | ||
* Helper math util to convert tension & friction values from the Origami design tool to values that | ||
* the spring system needs. | ||
*/ | ||
public class OrigamiValueConverter { | ||
|
||
public static double tensionFromOrigamiValue(double oValue) { | ||
return oValue == 0 ? 0 : (oValue - 30.0) * 3.62 + 194.0; | ||
} | ||
|
||
public static double origamiValueFromTension(double tension) { | ||
return tension == 0 ? 0 : (tension - 194.0) / 3.62 + 30.0; | ||
} | ||
|
||
public static double frictionFromOrigamiValue(double oValue) { | ||
return oValue == 0 ? 0 : (oValue - 8.0) * 3.0 + 25.0; | ||
} | ||
|
||
public static double origamiValueFromFriction(double friction) { | ||
return friction == 0 ? 0 : (friction - 25.0) / 3.0 + 8.0; | ||
} | ||
|
||
} |
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