From 4ff13042cfcddfefc8c8ab531449a30eebab0822 Mon Sep 17 00:00:00 2001 From: Sophie Zhang Date: Wed, 10 Apr 2024 16:16:35 -0400 Subject: organizing --- .../views/nodes/trails/CubicBezierEditor.tsx | 13 ++++-- src/client/views/nodes/trails/SlideEffect.scss | 3 ++ src/client/views/nodes/trails/SlideEffect.tsx | 51 +++++++++++++--------- 3 files changed, 44 insertions(+), 23 deletions(-) (limited to 'src/client/views/nodes/trails') diff --git a/src/client/views/nodes/trails/CubicBezierEditor.tsx b/src/client/views/nodes/trails/CubicBezierEditor.tsx index d6ce9db1f..f1a0a16ec 100644 --- a/src/client/views/nodes/trails/CubicBezierEditor.tsx +++ b/src/client/views/nodes/trails/CubicBezierEditor.tsx @@ -198,14 +198,21 @@ const CubicBezierEditor = ({ setFunc, currPoints, easeFunc }: Props) => { }} /> {/* Top right */} - { + { e.stopPropagation(); setC2Down(true); }} onPointerUp={e => { setC2Down(false); - }} x1={`${EDITOR_WIDTH + OFFSET}`} y1={`${0 + OFFSET}`} x2={`${cPoints.p2[0] * EDITOR_WIDTH + OFFSET}`} y2={`${EDITOR_WIDTH - cPoints.p2[1] * EDITOR_WIDTH + OFFSET}`} stroke="#00000000" - strokeWidth="5" /> + }} + x1={`${EDITOR_WIDTH + OFFSET}`} + y1={`${0 + OFFSET}`} + x2={`${cPoints.p2[0] * EDITOR_WIDTH + OFFSET}`} + y2={`${EDITOR_WIDTH - cPoints.p2[1] * EDITOR_WIDTH + OFFSET}`} + stroke="#00000000" + strokeWidth="5" + /> { - if (presEffect === PresEffect.Bounce) { - api.start(bounceConfig); - } else if (presEffect === PresEffect.Zoom) { - api.start(zoomConfig); - } else if (presEffect === PresEffect.Rotate) { - api.start(rotateConfig); - } else if (presEffect === PresEffect.Fade) { - api.start(fadeConfig); + switch (presEffect) { + case PresEffect.Bounce: + api.start(bounceConfig); + break; + case PresEffect.Zoom: + api.start(zoomConfig); + break; + case PresEffect.Rotate: + api.start(rotateConfig); + break; + case PresEffect.Fade: + api.start(fadeConfig); + break; + case PresEffect.Flip: + api.start(flipConfig); + break; + case PresEffect.Roll: + break; + case PresEffect.Lightspeed: + break; + default: + break; } }; @@ -215,23 +230,19 @@ export default function SpringAnimation({ dir, friction, tension, mass, presEffe // ); // }; - const flipRender = () => { - return ( -
- `perspective(600px) rotateX(${val}deg)`) }} /> - `perspective(600px) rotateX(${val}deg)`), rotateX: '180deg' }}> - {children} - -
- ); - }; - const getRenderDoc = () => { switch (presEffect) { case PresEffect.Rotate: return `rotate(${val}deg)`) }}>{children}; case PresEffect.Flip: - return flipRender(); + return ( +
+ `perspective(600px) rotateX(${val}deg)`) }} /> + `perspective(600px) rotateX(${val}deg)`), rotateX: '180deg' }}> + {children} + +
+ ); default: return (