From 438de8877a3cc1a6b663d43d163704c3cc01bd4a Mon Sep 17 00:00:00 2001
From: Sophie Zhang <sophie_zhang@brown.edu>
Date: Thu, 18 Apr 2024 11:30:20 -0400
Subject: context dependent preseffect

---
 src/client/views/nodes/trails/SlideEffect.tsx | 53 ++++++++++++++++++++++++---
 1 file changed, 48 insertions(+), 5 deletions(-)

(limited to 'src/client/views/nodes/trails/SlideEffect.tsx')

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,
-- 
cgit v1.2.3-70-g09d2

