ISSUE-045 - Venetian Blinds - Improvements to Venetian Blinds prototype controls.
Now you have 10 different options (5 for position flag and 5 for driver portrait) to play with, as well as a slot selector to choose different starting corners. I have to admit that I didn't want to deal with type juggling with DriverId so I do a pretty hacky job. This is just for prototyping purposes so it really shouldn't be much of a focus for me, right? Added an overall delay prop for VenetianBlindsTransition so that I don't need to deal with special timing issues for the DriverChyron animation in the future.
This commit is contained in:
1 parent
9518f934ae
commit
16c29df42f
6 files changed
+70
-23
No files matched your search
+7
-2
@@ -8,6 +8,7 @@ import { Milliseconds } from "../../../../types/util";
|
|||||||
|
|
||||||
type VenetianBlindsTransitionProps = {
|
type VenetianBlindsTransitionProps = {
|
||||||
visible: boolean,
|
visible: boolean,
|
||||||
|
delay?: Milliseconds,
|
||||||
blindsColor: string,
|
blindsColor: string,
|
||||||
blindsColorFadeDuration: Milliseconds,
|
blindsColorFadeDuration: Milliseconds,
|
||||||
blindsColorFadeDelay?: Milliseconds,
|
blindsColorFadeDelay?: Milliseconds,
|
||||||
@@ -26,6 +27,7 @@ type VenetianBlindsTransitionProps = {
|
|||||||
export const VenetianBlindsTransition = (
|
export const VenetianBlindsTransition = (
|
||||||
{
|
{
|
||||||
visible,
|
visible,
|
||||||
|
delay = 0,
|
||||||
blindsColor,
|
blindsColor,
|
||||||
blindsColorFadeDuration,
|
blindsColorFadeDuration,
|
||||||
blindsColorFadeDelay = 0,
|
blindsColorFadeDelay = 0,
|
||||||
@@ -51,18 +53,19 @@ export const VenetianBlindsTransition = (
|
|||||||
const { wipe } = useSpring({
|
const { wipe } = useSpring({
|
||||||
wipe: visible ? 1 : 0,
|
wipe: visible ? 1 : 0,
|
||||||
config: { duration: wipeDuration },
|
config: { duration: wipeDuration },
|
||||||
|
delay: 0 + delay,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { opacity } = useSpring({
|
const { opacity } = useSpring({
|
||||||
opacity: visible ? 1 : opacityStart,
|
opacity: visible ? 1 : opacityStart,
|
||||||
config: { duration: opacityDuration },
|
config: { duration: opacityDuration },
|
||||||
delay: opacityDelay,
|
delay: opacityDelay + delay,
|
||||||
});
|
});
|
||||||
|
|
||||||
const blindsSpring = useSpring({
|
const blindsSpring = useSpring({
|
||||||
opacity: visible ? 1 : 0,
|
opacity: visible ? 1 : 0,
|
||||||
config: { duration: blindsOpenDuration },
|
config: { duration: blindsOpenDuration },
|
||||||
delay: blindsOpenDelay,
|
delay: blindsOpenDelay + delay,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -92,6 +95,7 @@ export const VenetianBlindsTransition = (
|
|||||||
blindsColorFadeDelay={blindsColorFadeDelay}
|
blindsColorFadeDelay={blindsColorFadeDelay}
|
||||||
blindsClosing={visible}
|
blindsClosing={visible}
|
||||||
spanBlinkDuration={spanBlinkDuration}
|
spanBlinkDuration={spanBlinkDuration}
|
||||||
|
spanBlinkDelay={delay}
|
||||||
mirror={true} // Mirror version provides the opposite blinds.
|
mirror={true} // Mirror version provides the opposite blinds.
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
@@ -105,6 +109,7 @@ export const VenetianBlindsTransition = (
|
|||||||
blindsColorFadeDelay={blindsColorFadeDelay}
|
blindsColorFadeDelay={blindsColorFadeDelay}
|
||||||
blindsClosing={visible}
|
blindsClosing={visible}
|
||||||
spanBlinkDuration={spanBlinkDuration}
|
spanBlinkDuration={spanBlinkDuration}
|
||||||
|
spanBlinkDelay={delay}
|
||||||
mirror={false}
|
mirror={false}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ export const VenetianBlindsFilter = styled.div<VenetianBlindsFilterProps>`
|
|||||||
${({ blindsColorFadeDelay = 0 }) => blindsColorFadeDelay}ms;
|
${({ blindsColorFadeDelay = 0 }) => blindsColorFadeDelay}ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
${({ blindsClosing, spanBlinkDuration }) => (
|
${({ blindsClosing, spanBlinkDuration, spanBlinkDelay = 0 }) => (
|
||||||
blindsClosing && spanBlinkDuration
|
blindsClosing && spanBlinkDuration
|
||||||
? css`
|
? css`
|
||||||
span {
|
span {
|
||||||
animation: ${spanBlinkAnimation} ${spanBlinkDuration}ms step-end;
|
animation: ${spanBlinkAnimation} ${spanBlinkDuration}ms step-end ${spanBlinkDelay}ms;
|
||||||
};
|
};
|
||||||
`
|
`
|
||||||
: null)
|
: null)
|
||||||
|
|||||||
+16
-6
@@ -4,6 +4,8 @@ import { useSelector } from "react-redux";
|
|||||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||||
import { theme } from "../../../../shared/theme";
|
import { theme } from "../../../../shared/theme";
|
||||||
import { BasicBlock } from "../styles";
|
import { BasicBlock } from "../styles";
|
||||||
|
import { DriverId } from "../../../../types/state";
|
||||||
|
import { getDriver } from "../../../../utils/dataLookup";
|
||||||
|
|
||||||
import { DriverPortrait } from "../../../BroadcastGraphics/Common/DriverPortrait";
|
import { DriverPortrait } from "../../../BroadcastGraphics/Common/DriverPortrait";
|
||||||
import { PositionFlag } from "../../../BroadcastGraphics/Common/PositionFlag";
|
import { PositionFlag } from "../../../BroadcastGraphics/Common/PositionFlag";
|
||||||
@@ -22,7 +24,11 @@ export function VenetianBlindsWorkspace() {
|
|||||||
{prototypeState?.venetianTransition?.mode === "driverPortrait" ? (
|
{prototypeState?.venetianTransition?.mode === "driverPortrait" ? (
|
||||||
<VenetianBlindsTransition
|
<VenetianBlindsTransition
|
||||||
visible={visible}
|
visible={visible}
|
||||||
blindsColor={theme.colors.teams.redBull}
|
blindsColor={theme.colors.teams[
|
||||||
|
getDriver( // This is very sus. This would not fly in production.
|
||||||
|
prototypeState?.venetianTransition?.subMode as DriverId ?? "hamilton",
|
||||||
|
).team.id
|
||||||
|
]}
|
||||||
blindsColorFadeDuration={600}
|
blindsColorFadeDuration={600}
|
||||||
blindsColorFadeDelay={300}
|
blindsColorFadeDelay={300}
|
||||||
blindsAngle={-45}
|
blindsAngle={-45}
|
||||||
@@ -31,10 +37,12 @@ export function VenetianBlindsWorkspace() {
|
|||||||
blindsSize={{ transparent: 2, opaque: 5 }}
|
blindsSize={{ transparent: 2, opaque: 5 }}
|
||||||
wipeAngle={45}
|
wipeAngle={45}
|
||||||
wipeDuration={600}
|
wipeDuration={600}
|
||||||
wipeStartingCorner="topLeft"
|
wipeStartingCorner={
|
||||||
|
prototypeState?.venetianTransition?.wipeStartingCorner ?? "bottomRight"
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<DriverPortrait
|
<DriverPortrait
|
||||||
driverId="verstappen"
|
driverId={prototypeState?.venetianTransition?.subMode as DriverId ?? "hamilton"}
|
||||||
height={250}
|
height={250}
|
||||||
/>
|
/>
|
||||||
</VenetianBlindsTransition>
|
</VenetianBlindsTransition>
|
||||||
@@ -46,17 +54,19 @@ export function VenetianBlindsWorkspace() {
|
|||||||
blindsColorFadeDelay={200}
|
blindsColorFadeDelay={200}
|
||||||
blindsAngle={-45}
|
blindsAngle={-45}
|
||||||
blindsOpenDuration={100}
|
blindsOpenDuration={100}
|
||||||
blindsOpenDelay={100}
|
blindsOpenDelay={150}
|
||||||
blindsSize={{ transparent: 3, opaque: 6 }}
|
blindsSize={{ transparent: 3, opaque: 6 }}
|
||||||
wipeAngle={40}
|
wipeAngle={40}
|
||||||
wipeDuration={300}
|
wipeDuration={300}
|
||||||
wipeStartingCorner="bottomRight"
|
wipeStartingCorner={
|
||||||
|
prototypeState?.venetianTransition?.wipeStartingCorner ?? "bottomRight"
|
||||||
|
}
|
||||||
opacityStart={0.1}
|
opacityStart={0.1}
|
||||||
opacityDuration={200}
|
opacityDuration={200}
|
||||||
opacityDelay={100}
|
opacityDelay={100}
|
||||||
spanBlinkDuration={500}
|
spanBlinkDuration={500}
|
||||||
>
|
>
|
||||||
<PositionFlag size={122} number={1} />
|
<PositionFlag size={122} number={parseInt(prototypeState?.venetianTransition?.subMode ?? "1")} />
|
||||||
</VenetianBlindsTransition>
|
</VenetianBlindsTransition>
|
||||||
)}
|
)}
|
||||||
</BasicBlock>
|
</BasicBlock>
|
||||||
|
|||||||
+39
-6
@@ -1,26 +1,47 @@
|
|||||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||||
import { PadBox } from "@bedrock-layout/padbox";
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
|
import { useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||||
import { updateVenetianTransition } from "../../../../features/workspace/workspaceSlice";
|
import { updateVenetianTransition } from "../../../../features/workspace/workspaceSlice";
|
||||||
import { VenetianTransitionWorkspaceMode } from "../../../../types/state";
|
import { DriverId } from "../../../../types/state";
|
||||||
|
import { Corner } from "../../../../types/style";
|
||||||
|
|
||||||
import { SlotSelector } from "../../../Common/Inputs/SlotSelector";
|
import { SlotSelector } from "../../../Common/Inputs/SlotSelector";
|
||||||
import { Toggle } from "../../../Common/Inputs/Toggle";
|
import { Toggle } from "../../../Common/Inputs/Toggle";
|
||||||
|
|
||||||
const modes: Array<VenetianTransitionWorkspaceMode> = [
|
|
||||||
"positionFlag",
|
// NOTE: This is all hacky and 100% wouldn't fly in production code.
|
||||||
"driverPortrait",
|
const modes = ["positionFlag", "driverPortrait"];
|
||||||
|
const subModes: [string[], DriverId[]] = [
|
||||||
|
["1", "3", "5", "10", "20"],
|
||||||
|
["hamilton", "verstappen", "schumacher", "alonso", "leclerc"],
|
||||||
];
|
];
|
||||||
|
const corners: Corner[] = ["bottomRight", "bottomLeft", "topLeft", "topRight"];
|
||||||
|
|
||||||
export function VenetianBlindsPrototypeControls() {
|
export function VenetianBlindsPrototypeControls() {
|
||||||
|
const [modeIndex, setModeIndex] = useState(0);
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { prototypeState } = useSelector(workspaceSelector);
|
const { prototypeState } = useSelector(workspaceSelector);
|
||||||
|
|
||||||
const onChange = (index: number) => {
|
const changeMode = (index: number) => {
|
||||||
|
setModeIndex(index);
|
||||||
|
|
||||||
dispatch(updateVenetianTransition({
|
dispatch(updateVenetianTransition({
|
||||||
mode: modes[index],
|
mode: modes[index],
|
||||||
|
subMode: subModes[index][0],
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
const changeSubMode = (index: number) => {
|
||||||
|
dispatch(updateVenetianTransition({
|
||||||
|
subMode: subModes[modeIndex][index],
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
const onChangeStartingCorner = (index: number) => {
|
||||||
|
dispatch(updateVenetianTransition({
|
||||||
|
wipeStartingCorner: corners[index],
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -34,10 +55,22 @@ export function VenetianBlindsPrototypeControls() {
|
|||||||
<InlineCluster as={PadBox} gutter="md" padding="md">
|
<InlineCluster as={PadBox} gutter="md" padding="md">
|
||||||
<SlotSelector
|
<SlotSelector
|
||||||
items={modes}
|
items={modes}
|
||||||
onChange={onChange}
|
onChange={changeMode}
|
||||||
label="Mode"
|
label="Mode"
|
||||||
slotWidth="200px"
|
slotWidth="200px"
|
||||||
/>
|
/>
|
||||||
|
<SlotSelector
|
||||||
|
items={subModes[modeIndex]}
|
||||||
|
onChange={changeSubMode}
|
||||||
|
label="SubMode"
|
||||||
|
slotWidth="200px"
|
||||||
|
/>
|
||||||
|
<SlotSelector
|
||||||
|
items={corners}
|
||||||
|
onChange={onChangeStartingCorner}
|
||||||
|
label="Starting Corner"
|
||||||
|
slotWidth="200px"
|
||||||
|
/>
|
||||||
<Toggle
|
<Toggle
|
||||||
toggled={prototypeState?.venetianTransition?.showBG ?? true}
|
toggled={prototypeState?.venetianTransition?.showBG ?? true}
|
||||||
onToggle={onToggle}
|
onToggle={onToggle}
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ export const workspaceSlice = createSlice({
|
|||||||
) => {
|
) => {
|
||||||
if (state.prototypeState.venetianTransition == null) {
|
if (state.prototypeState.venetianTransition == null) {
|
||||||
state.prototypeState.venetianTransition = {
|
state.prototypeState.venetianTransition = {
|
||||||
mode: "positionFlag",
|
mode: "portraitFlag",
|
||||||
|
subMode: "1",
|
||||||
showBG: true,
|
showBG: true,
|
||||||
timing: 500,
|
wipeStartingCorner: "bottomRight",
|
||||||
startingCorner: "topLeft",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
state.prototypeState.venetianTransition = Object.assign(
|
state.prototypeState.venetianTransition = Object.assign(
|
||||||
|
|||||||
Vendored
+3
-4
@@ -42,13 +42,12 @@ export interface PrototypeState {
|
|||||||
flagB: TeamId;
|
flagB: TeamId;
|
||||||
};
|
};
|
||||||
venetianTransition?: {
|
venetianTransition?: {
|
||||||
mode: VenetianTransitionWorkspaceMode;
|
mode: string,
|
||||||
|
subMode: string,
|
||||||
showBG: boolean;
|
showBG: boolean;
|
||||||
timing: number,
|
wipeStartingCorner: Corner,
|
||||||
startingCorner: Corner,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export type VenetianTransitionWorkspaceMode = "positionFlag" | "driverPortrait";
|
|
||||||
|
|
||||||
// Overlay Tool
|
// Overlay Tool
|
||||||
export interface OverlayTool {
|
export interface OverlayTool {
|
||||||
|
|||||||
Reference in new issue
Block a user