From 438de8877a3cc1a6b663d43d163704c3cc01bd4a Mon Sep 17 00:00:00 2001 From: Sophie Zhang Date: Thu, 18 Apr 2024 11:30:20 -0400 Subject: context dependent preseffect --- src/client/views/nodes/trails/PresBox.tsx | 217 ++++++++++++++------------ src/client/views/nodes/trails/SlideEffect.tsx | 53 ++++++- 2 files changed, 164 insertions(+), 106 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx index 62458acfe..5ce010cf7 100644 --- a/src/client/views/nodes/trails/PresBox.tsx +++ b/src/client/views/nodes/trails/PresBox.tsx @@ -2216,49 +2216,60 @@ export class PresBox extends ViewBoxBaseComponent() { */} {/* Effect direction */} -
-
Effect direction
-
- {StrCast(this.activeItem.presentation_effectDirection)} -
-
-
- } - onClick={() => this.updateEffectDirection(PresEffectDirection.Center)} - /> - } - onClick={() => this.updateEffectDirection(PresEffectDirection.Left)} - /> - } - onClick={() => this.updateEffectDirection(PresEffectDirection.Right)} - /> - } - onClick={() => this.updateEffectDirection(PresEffectDirection.Top)} - /> - } - onClick={() => this.updateEffectDirection(PresEffectDirection.Bottom)} - /> -
+ {/* Only applies to certain effects */} + {effect === PresEffect.Flip || + effect === PresEffect.Bounce || + (effect === PresEffect.Roll && ( + <> +
+
Effect direction
+
+ {StrCast(this.activeItem.presentation_effectDirection)} +
+
+
+ } + onClick={() => this.updateEffectDirection(PresEffectDirection.Center)} + /> + } + onClick={() => this.updateEffectDirection(PresEffectDirection.Left)} + /> + } + onClick={() => this.updateEffectDirection(PresEffectDirection.Right)} + /> + {effect !== PresEffect.Roll && ( + <> + } + onClick={() => this.updateEffectDirection(PresEffectDirection.Top)} + /> + } + onClick={() => this.updateEffectDirection(PresEffectDirection.Bottom)} + /> + + )} +
+ + ))} {/* Spring settings */} {/* No spring settings for jackinthebox (lightspeed) */}
() { {`${this.showSpringEditor ? 'Hide' : 'Show'} Spring Settings`}
- {effect !== PresEffect.Lightspeed && this.showSpringEditor && ( + {effect !== PresEffect.Lightspeed && ( <> () { dropdownType={DropdownType.SELECT} type={Type.TERT} /> -
Tension
-
{ - e.stopPropagation(); - }}> - { - if (!timingConfig) return; - this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, stiffness: val as number }); - }} - valueLabelDisplay="auto" - /> -
-
Damping
-
{ - e.stopPropagation(); - }}> - { - if (!timingConfig) return; - this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, damping: val as number }); - }} - valueLabelDisplay="auto" - /> -
-
Mass
-
{ - e.stopPropagation(); - }}> - { - if (!timingConfig) return; - this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, mass: val as number }); - }} - valueLabelDisplay="auto" - /> -
- -
-
+ {this.showSpringEditor && ( + <> +
Tension
+
{ + e.stopPropagation(); + }}> + { + if (!timingConfig) return; + this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, stiffness: val as number }); + }} + valueLabelDisplay="auto" + /> +
+
Damping
+
{ + e.stopPropagation(); + }}> + { + if (!timingConfig) return; + this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, damping: val as number }); + }} + valueLabelDisplay="auto" + /> +
+
Mass
+
{ + e.stopPropagation(); + }}> + { + if (!timingConfig) return; + this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, mass: val as number }); + }} + valueLabelDisplay="auto" + /> +
+ +
+
+ + )} )} {/* Effect spring settings */} 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