diff options
| author | Sophie Zhang <sophie_zhang@brown.edu> | 2024-04-18 11:30:20 -0400 |
|---|---|---|
| committer | Sophie Zhang <sophie_zhang@brown.edu> | 2024-04-18 11:30:20 -0400 |
| commit | 438de8877a3cc1a6b663d43d163704c3cc01bd4a (patch) | |
| tree | b082c0e3768b90821fce669f3fde126d1897a1e0 /src/client/views/nodes/trails/SlideEffect.tsx | |
| parent | 70b582db9a8cecc742be3c2b5f043a70a15c7991 (diff) | |
context dependent preseffect
Diffstat (limited to 'src/client/views/nodes/trails/SlideEffect.tsx')
| -rw-r--r-- | src/client/views/nodes/trails/SlideEffect.tsx | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/src/client/views/nodes/trails/SlideEffect.tsx b/src/client/views/nodes/trails/SlideEffect.tsx index 20ff4b0b9..bd667b925 100644 --- a/src/client/views/nodes/trails/SlideEffect.tsx +++ b/src/client/views/nodes/trails/SlideEffect.tsx @@ -180,12 +180,55 @@ export default function SpringAnimation({ doc, delay, dir, friction, tension, ma }, }; + // only left and right for now + const getRollConfigFrom = () => { + switch (dir) { + case PresEffectDirection.Left: + return { + from: { + opacity: 0, + x: -100, + y: -120, + }, + }; + case PresEffectDirection.Right: + return { + from: { + opacity: 0, + x: 100, + y: -120, + }, + }; + case PresEffectDirection.Top: + return { + from: { + opacity: 0, + x: -100, + y: -120, + }, + }; + case PresEffectDirection.Bottom: + return { + from: { + opacity: 0, + x: -100, + y: -120, + }, + }; + default: + // no movement for center + return { + from: { + opacity: 0, + x: 0, + y: 0, + }, + }; + } + }; + const rollConfig = { - from: { - opacity: 0, - x: -100, - y: -120, - }, + ...getRollConfigFrom(), to: { opacity: 1, x: 0, |
