Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hard coded tween working for anim input link
- Loading branch information
1 parent
5d50db9
commit ed8c577
Showing
10 changed files
with
64 additions
and
22 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function uAnimStart (linkId) { | ||
return { | ||
type: 'U_ANIM_START', | ||
payload: { | ||
linkId, | ||
}, | ||
} | ||
} |
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,29 @@ | ||
import getInputLink from '../../selectors/getInputLink' | ||
import getNode from '../../selectors/getNode' | ||
import { nodeValueUpdate } from '../nodes/actions' | ||
import TWEEN from '@tweenjs/tween.js' | ||
|
||
const handleAnimStart = (action, store) => { | ||
const state = store.getState() | ||
const inputLink = getInputLink(state, action.payload.linkId) | ||
const node = getNode(state, inputLink.nodeId) | ||
const props = { | ||
nodeValue: node.value, | ||
} | ||
|
||
new TWEEN.Tween(props) | ||
.to({ nodeValue: 0.9 }, 1000) | ||
.easing(TWEEN.Easing.Quadratic.Out) | ||
.onUpdate(() => { | ||
store.dispatch(nodeValueUpdate(inputLink.nodeId, props.nodeValue)) | ||
}) | ||
.start() | ||
} | ||
|
||
export default (action, store) => { | ||
switch (action.type) { | ||
case 'U_ANIM_START': | ||
handleAnimStart(action, store) | ||
break | ||
} | ||
} |
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