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
+16
-6
@@ -4,6 +4,8 @@ import { useSelector } from "react-redux";
|
||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import { BasicBlock } from "../styles";
|
||||
import { DriverId } from "../../../../types/state";
|
||||
import { getDriver } from "../../../../utils/dataLookup";
|
||||
|
||||
import { DriverPortrait } from "../../../BroadcastGraphics/Common/DriverPortrait";
|
||||
import { PositionFlag } from "../../../BroadcastGraphics/Common/PositionFlag";
|
||||
@@ -22,7 +24,11 @@ export function VenetianBlindsWorkspace() {
|
||||
{prototypeState?.venetianTransition?.mode === "driverPortrait" ? (
|
||||
<VenetianBlindsTransition
|
||||
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}
|
||||
blindsColorFadeDelay={300}
|
||||
blindsAngle={-45}
|
||||
@@ -31,10 +37,12 @@ export function VenetianBlindsWorkspace() {
|
||||
blindsSize={{ transparent: 2, opaque: 5 }}
|
||||
wipeAngle={45}
|
||||
wipeDuration={600}
|
||||
wipeStartingCorner="topLeft"
|
||||
wipeStartingCorner={
|
||||
prototypeState?.venetianTransition?.wipeStartingCorner ?? "bottomRight"
|
||||
}
|
||||
>
|
||||
<DriverPortrait
|
||||
driverId="verstappen"
|
||||
driverId={prototypeState?.venetianTransition?.subMode as DriverId ?? "hamilton"}
|
||||
height={250}
|
||||
/>
|
||||
</VenetianBlindsTransition>
|
||||
@@ -46,17 +54,19 @@ export function VenetianBlindsWorkspace() {
|
||||
blindsColorFadeDelay={200}
|
||||
blindsAngle={-45}
|
||||
blindsOpenDuration={100}
|
||||
blindsOpenDelay={100}
|
||||
blindsOpenDelay={150}
|
||||
blindsSize={{ transparent: 3, opaque: 6 }}
|
||||
wipeAngle={40}
|
||||
wipeDuration={300}
|
||||
wipeStartingCorner="bottomRight"
|
||||
wipeStartingCorner={
|
||||
prototypeState?.venetianTransition?.wipeStartingCorner ?? "bottomRight"
|
||||
}
|
||||
opacityStart={0.1}
|
||||
opacityDuration={200}
|
||||
opacityDelay={100}
|
||||
spanBlinkDuration={500}
|
||||
>
|
||||
<PositionFlag size={122} number={1} />
|
||||
<PositionFlag size={122} number={parseInt(prototypeState?.venetianTransition?.subMode ?? "1")} />
|
||||
</VenetianBlindsTransition>
|
||||
)}
|
||||
</BasicBlock>
|
||||
|
||||
+39
-6
@@ -1,26 +1,47 @@
|
||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||
import { PadBox } from "@bedrock-layout/padbox";
|
||||
import { useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||
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 { Toggle } from "../../../Common/Inputs/Toggle";
|
||||
|
||||
const modes: Array<VenetianTransitionWorkspaceMode> = [
|
||||
"positionFlag",
|
||||
"driverPortrait",
|
||||
|
||||
// NOTE: This is all hacky and 100% wouldn't fly in production code.
|
||||
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() {
|
||||
const [modeIndex, setModeIndex] = useState(0);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const { prototypeState } = useSelector(workspaceSelector);
|
||||
|
||||
const onChange = (index: number) => {
|
||||
const changeMode = (index: number) => {
|
||||
setModeIndex(index);
|
||||
|
||||
dispatch(updateVenetianTransition({
|
||||
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">
|
||||
<SlotSelector
|
||||
items={modes}
|
||||
onChange={onChange}
|
||||
onChange={changeMode}
|
||||
label="Mode"
|
||||
slotWidth="200px"
|
||||
/>
|
||||
<SlotSelector
|
||||
items={subModes[modeIndex]}
|
||||
onChange={changeSubMode}
|
||||
label="SubMode"
|
||||
slotWidth="200px"
|
||||
/>
|
||||
<SlotSelector
|
||||
items={corners}
|
||||
onChange={onChangeStartingCorner}
|
||||
label="Starting Corner"
|
||||
slotWidth="200px"
|
||||
/>
|
||||
<Toggle
|
||||
toggled={prototypeState?.venetianTransition?.showBG ?? true}
|
||||
onToggle={onToggle}
|
||||
|
||||
Reference in new issue
Block a user