forked from bhovhannes/additween
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow pass custom state reducer to the animation process
- Loading branch information
1 parent
d440265
commit ffac0b4
Showing
5 changed files
with
85 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
AdditiveTweening: require('./src/additiveTweening') | ||
AdditiveTweening: require('./src/AdditiveTweening'), | ||
PlainObjectReducer: require('./src/PlainObjectReducer') | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
clone: function (obj) { | ||
var target = {}, | ||
key | ||
for (key in obj) { | ||
target[key] = obj[key] | ||
} | ||
return target | ||
}, | ||
|
||
reduce: function (targetState, toState, fromState, pos) { | ||
var key | ||
for (key in targetState) { | ||
targetState[key] -= (toState[key] - fromState[key]) * pos | ||
} | ||
return targetState | ||
} | ||
} |