diff --git a/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx b/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx
index 61b94ba..be19b50 100644
--- a/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx
+++ b/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx
@@ -4,25 +4,23 @@ import { theme } from "../../../../shared/theme";
import { DriverNumber } from "../../Common/DriverNumber";
import { AngledFlag } from "../../Common/AngledFlag";
+import { PositionFlag } from "../../Common/PositionFlag";
+import { DriverPortrait } from "../../Common/DriverPortrait";
import {
BaseBackground,
FirstName,
- PositionNumber,
LastName,
NameContainer,
NumberContainer,
- PositionFlag,
Spacer,
TeamColorBar,
TeamName,
TextContainer,
FlagContainer,
- PortraitDiv,
BaseContainer,
+ DriverPortraitContainer,
} from "./styles";
-const driverPortraits = require.context("../../../../public/images/drivers/front", true);
-
type ChyronDriverProps = {
chyronData: BGChyronDriver,
subMode: BGChyronSubMode,
@@ -42,11 +40,7 @@ export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
{showPosFlag && (
-
-
- {car.position}
-
-
+
)}
@@ -81,11 +75,13 @@ export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
{showPortrait && (
-
+
+
+
)}
);
diff --git a/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts b/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts
index 97ca527..537c022 100644
--- a/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts
+++ b/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts
@@ -1,5 +1,6 @@
import styled from "styled-components";
-import { Px } from "../../../../types/style";
+import { Placement, Px } from "../../../../types/style";
+import { placementStyleRules } from "../../../../utils/styling";
type BaseContainerProps = {
width: Px,
@@ -27,33 +28,6 @@ export const BaseBackground = styled.div`
`;
BaseBackground.displayName = "BaseBackground";
-type PositionFlagProps = {
- containerHeight: Px,
-};
-export const PositionFlag = styled.div`
- position: relative;
- height: ${({ containerHeight }) => `${containerHeight * 0.85}px`};
- width: ${({ containerHeight }) => `${containerHeight * 0.85}px`};
-
- border-bottom-right-radius: 9px;
- background-color: #f4f3ee;
-
- display: flex;
- align-items: center;
- justify-content: center;
-`;
-PositionFlag.displayName = "PositionFlag";
-
-type PositionNumberProps = {
- containerHeight: Px,
-};
-export const PositionNumber = styled.span`
- font-family: ${p => p.theme.fonts.f1Regular};
- font-size: ${({ containerHeight }) => `${containerHeight * 0.85 * 0.64}px`};
- margin-top: 2px;
-`;
-PositionNumber.displayName = "PositionNumber";
-
type TeamColorBarProps = {
color: string,
};
@@ -144,23 +118,12 @@ export const FlagContainer = styled.div`
`;
FlagContainer.displayName = "FlagContainer";
-type PortraitDivProps = {
- src: string,
- height: Px,
- rightMargin: Px,
+type DriverPortraitContainerProps = {
+ placement: Placement,
};
-export const PortraitDiv = styled.div`
+export const DriverPortraitContainer = styled.div`
position: absolute;
- height: ${({ height }) => `${height}px`};
- width: ${({ height }) => `${height * 1.4}px`};
-
- bottom: 0;
- right: ${({ rightMargin }) => `${rightMargin}px`};
-
- background-image: url(${({ src }) => src});
- background-size: contain;
- background-repeat: no-repeat;
- background-position: center ${({ height }) => `${height * .18}px`};
+ ${({ placement }) => placementStyleRules(placement)}
`;
-PortraitDiv.displayName = "PortraitDiv";
+DriverPortraitContainer.displayName = "DriverPortraitContainer";
diff --git a/src/components/BroadcastGraphics/Common/DriverPortrait/DriverPortrait.tsx b/src/components/BroadcastGraphics/Common/DriverPortrait/DriverPortrait.tsx
new file mode 100644
index 0000000..ac235fe
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/DriverPortrait/DriverPortrait.tsx
@@ -0,0 +1,25 @@
+import { DriverId } from "../../../../types/state";
+import { Percent, Px } from "../../../../types/style";
+
+import { PortraitDiv } from "./styles";
+
+const driverPortraits = require.context("../../../../public/images/drivers/front", true);
+
+type DriverPortraitProps = {
+ driverId: DriverId,
+ height: Px,
+ verticalOffsetPercentage?: Percent,
+};
+export function DriverPortrait({
+ driverId,
+ height,
+ verticalOffsetPercentage = 0,
+}: DriverPortraitProps) {
+ return (
+
+ );
+}
diff --git a/src/components/BroadcastGraphics/Common/DriverPortrait/index.ts b/src/components/BroadcastGraphics/Common/DriverPortrait/index.ts
new file mode 100644
index 0000000..032c94a
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/DriverPortrait/index.ts
@@ -0,0 +1 @@
+export * from "./DriverPortrait";
diff --git a/src/components/BroadcastGraphics/Common/DriverPortrait/styles.ts b/src/components/BroadcastGraphics/Common/DriverPortrait/styles.ts
new file mode 100644
index 0000000..f509334
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/DriverPortrait/styles.ts
@@ -0,0 +1,29 @@
+import styled from "styled-components";
+
+import { Percent, Px } from "../../../../types/style";
+
+type PortraitDivProps = {
+ src: string,
+ height: Px,
+ verticalOffsetPercentage: Percent,
+};
+export const PortraitDiv = styled.div`
+ height: ${({ height }) => `${height}px`};
+ width: ${({ height }) => `${height * 1.4}px`};
+
+ --image: url(${({ src }) => src});
+ --position: center ${({ height, verticalOffsetPercentage }) =>
+ `${height * (verticalOffsetPercentage / 100)}px`};
+
+ background-image: var(--image);
+ background-size: contain;
+ background-repeat: no-repeat;
+ background-position: var(--position);
+
+ /* Redundant masking to allow special filters to work. */
+ mask-image: var(--image);
+ mask-size: contain;
+ mask-repeat: no-repeat;
+ mask-position: var(--position);
+`;
+PortraitDiv.displayName = "PortraitDiv";
diff --git a/src/components/BroadcastGraphics/Common/PositionFlag/PositionFlag.tsx b/src/components/BroadcastGraphics/Common/PositionFlag/PositionFlag.tsx
new file mode 100644
index 0000000..7903f6a
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/PositionFlag/PositionFlag.tsx
@@ -0,0 +1,17 @@
+import { Px } from "../../../../types/style";
+
+import { PositionFlagBox, PositionNumber } from "./styles";
+
+type PositionFlagProps = {
+ size: Px,
+ number: number,
+};
+export function PositionFlag({ size, number }: PositionFlagProps) {
+ return (
+
+
+ {number}
+
+
+ );
+}
diff --git a/src/components/BroadcastGraphics/Common/PositionFlag/index.ts b/src/components/BroadcastGraphics/Common/PositionFlag/index.ts
new file mode 100644
index 0000000..68f7fb9
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/PositionFlag/index.ts
@@ -0,0 +1 @@
+export * from "./PositionFlag";
diff --git a/src/components/BroadcastGraphics/Common/PositionFlag/styles.ts b/src/components/BroadcastGraphics/Common/PositionFlag/styles.ts
new file mode 100644
index 0000000..d9cfbbe
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/PositionFlag/styles.ts
@@ -0,0 +1,29 @@
+import styled from "styled-components";
+import { Px } from "../../../../types/style";
+
+type PositionFlagBoxProps = {
+ size: Px,
+};
+export const PositionFlagBox = styled.div`
+ position: relative;
+ height: ${({ size }) => `${size}px`};
+ width: ${({ size }) => `${size}px`};
+
+ border-bottom-right-radius: 15%;
+ background-color: #f4f3ee;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+`;
+PositionFlagBox.displayName = "PositionFlagBox";
+
+type PositionNumberProps = {
+ size: Px,
+};
+export const PositionNumber = styled.span`
+ font-family: ${p => p.theme.fonts.f1Regular};
+ font-size: ${({ size }) => `${size * 0.64}px`};
+ margin-top: 2px;
+`;
+PositionNumber.displayName = "PositionNumber";
diff --git a/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/VenetianBlindsTransition.tsx b/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/VenetianBlindsTransition.tsx
new file mode 100644
index 0000000..5dd068f
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/VenetianBlindsTransition.tsx
@@ -0,0 +1,119 @@
+import { useSpring, animated } from "@react-spring/web";
+import useMeasure from "react-use-measure";
+
+import { AnimatedVenetianBlindsFilter, VenetianBlindsFilter } from "./styles";
+import { wipeCustomDegClip } from "../../../../utils/styling";
+import { Corner, Degrees, Fraction, Px } from "../../../../types/style";
+import { Milliseconds } from "../../../../types/util";
+
+type VenetianBlindsTransitionProps = {
+ visible: boolean,
+ delay?: Milliseconds,
+ blindsColor: string,
+ blindsColorFadeDuration: Milliseconds,
+ blindsColorFadeDelay?: Milliseconds,
+ blindsAngle: Degrees,
+ blindsOpenDuration: Milliseconds,
+ blindsOpenDelay?: Milliseconds,
+ blindsSize: { opaque: Px, transparent: Px },
+ wipeAngle: Degrees,
+ wipeDuration: Milliseconds,
+ wipeStartingCorner: Corner,
+ opacityStart?: Fraction,
+ opacityDuration?: Milliseconds,
+ opacityDelay?: Milliseconds,
+ spanBlinkDuration?: Milliseconds,
+};
+export const VenetianBlindsTransition = (
+ {
+ visible,
+ delay = 0,
+ blindsColor,
+ blindsColorFadeDuration,
+ blindsColorFadeDelay = 0,
+ blindsAngle,
+ blindsOpenDuration,
+ blindsOpenDelay = 0,
+ blindsSize,
+ wipeAngle,
+ wipeDuration,
+ wipeStartingCorner,
+ opacityStart = 1,
+ opacityDuration = wipeDuration,
+ opacityDelay = 0,
+ spanBlinkDuration,
+ children,
+ }: React.PropsWithChildren,
+) => {
+ const [childRef, {
+ height: childHeight,
+ width: childWidth,
+ }] = useMeasure();
+
+ const { wipe } = useSpring({
+ wipe: visible ? 1 : 0,
+ config: { duration: wipeDuration },
+ delay: 0 + delay,
+ });
+
+ const { opacity } = useSpring({
+ opacity: visible ? 1 : opacityStart,
+ config: { duration: opacityDuration },
+ delay: opacityDelay + delay,
+ });
+
+ const blindsSpring = useSpring({
+ opacity: visible ? 1 : 0,
+ config: { duration: blindsOpenDuration },
+ delay: blindsOpenDelay + delay,
+ });
+
+ return (
+ {
+ const [a1, a2, b1, b2, c1, c2] = wipeCustomDegClip(
+ childWidth,
+ childHeight,
+ wipeProgress,
+ wipeStartingCorner,
+ wipeAngle,
+ );
+ return `polygon(${a1}px ${a2}px, ${b1}px ${b2}px, ${c1}px ${c2}px)`;
+ }),
+ }}
+ ref={childRef}
+ >
+
+ {children}
+
+
+ {children}
+
+
+ );
+};
diff --git a/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/index.ts b/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/index.ts
new file mode 100644
index 0000000..a2169a7
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/index.ts
@@ -0,0 +1 @@
+export * from "./VenetianBlindsTransition";
diff --git a/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/styles.ts b/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/styles.ts
new file mode 100644
index 0000000..73169a7
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/styles.ts
@@ -0,0 +1,64 @@
+import { animated } from "@react-spring/web";
+import styled, { css, keyframes } from "styled-components";
+
+import { Degrees, Px } from "../../../../types/style";
+import { Milliseconds } from "../../../../types/util";
+
+const spanBlinkAnimation = keyframes`
+ 0% { opacity: 0 }
+ 62% { opacity: 1 }
+ 72% { opacity: 0 }
+ 81% { opacity: 1 }
+ 91% { opacity: 0 }
+ 100% { opacity: 1 }
+`;
+
+type VenetianBlindsFilterProps = {
+ blindsAngle: Degrees,
+ transparentWidth: Px,
+ opaqueWidth: Px,
+ blindsColor: string,
+ blindsColorFadeDuration: Milliseconds,
+ blindsColorFadeDelay?: Milliseconds,
+ blindsClosing: boolean,
+ mirror?: boolean,
+ spanBlinkDuration?: Milliseconds,
+ spanBlinkDelay?: Milliseconds,
+};
+export const VenetianBlindsFilter = styled.div`
+ position: ${({ mirror }) => mirror ? "absolute" : null};
+
+ --A: ${({ mirror }) => mirror ? "transparent" : "black"};
+ --B: ${({ mirror }) => mirror ? "black" : "transparent"};
+
+ mask-image: repeating-linear-gradient(
+ ${({ blindsAngle }) => blindsAngle}deg,
+ var(--A),
+ var(--A) ${({ opaqueWidth }) => opaqueWidth}px,
+ var(--B) ${({ opaqueWidth }) => opaqueWidth}px,
+ var(--B) ${({ transparentWidth, opaqueWidth }) => transparentWidth + opaqueWidth}px
+ );
+
+ > * {
+ box-shadow: inset 0 0 0 99999px ${({ blindsColor, blindsClosing }) =>
+ `${blindsColor}${blindsClosing ? "00" : "cc"}`};
+ transition: box-shadow
+ ${({ blindsColorFadeDuration }) => blindsColorFadeDuration}ms
+ cubic-bezier(0.88, 0.18, 0.96, 0.75)
+ ${({ blindsColorFadeDelay = 0 }) => blindsColorFadeDelay}ms;
+ }
+
+ ${({ blindsClosing, spanBlinkDuration, spanBlinkDelay = 0 }) => (
+ blindsClosing && spanBlinkDuration
+ ? css`
+ span {
+ animation: ${spanBlinkAnimation} ${spanBlinkDuration}ms step-end ${spanBlinkDelay}ms;
+ };
+ `
+ : null)
+}
+`;
+VenetianBlindsFilter.displayName = "VenetianBlindsFilter";
+
+export const AnimatedVenetianBlindsFilter = animated(VenetianBlindsFilter);
+AnimatedVenetianBlindsFilter.displayName = "AnimatedVenetianBlindsFilter";
diff --git a/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx b/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx
index 691f26a..2a1a221 100644
--- a/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx
+++ b/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx
@@ -3,6 +3,8 @@ import { useDrag } from "@use-gesture/react";
import useMeasure from "react-use-measure";
import { clamp } from "lodash";
+import { Fraction } from "../../../../types/style";
+
import {
AnimatedProgressSliderBar,
ProgressSliderBarHandle,
@@ -19,7 +21,7 @@ const MARGIN_WIDTH = 15;
const percentage = (value: number) => `${Math.floor(value * 100)}%`;
type ProgressSliderProps = {
- value: number, // Fraction of 1 (0.0 to 1.0)
+ value: Fraction,
onChange: (value: number) => void,
disabled?: boolean,
formatter?: (value: number) => string,
diff --git a/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/AngledFlagWorkspace.tsx b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/AngledFlagWorkspace.tsx
index a715d82..3ce1e9c 100644
--- a/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/AngledFlagWorkspace.tsx
+++ b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/AngledFlagWorkspace.tsx
@@ -4,7 +4,7 @@ import { workspaceSelector } from "../../../../features/workspace/workspaceSelec
import { FlagMode, TeamId } from "../../../../types/state";
import { AngledFlag } from "../../../BroadcastGraphics/Common/AngledFlag";
-import { BasicBlock } from "./styles";
+import { BasicBlock } from "../styles";
type AngledFlagWorkspaceProps = {
flagMode: FlagMode,
diff --git a/src/components/Workspaces/CustomWorkSpaces/VenetianBlindsWorkspace/VenetianBlindsWorkspace.tsx b/src/components/Workspaces/CustomWorkSpaces/VenetianBlindsWorkspace/VenetianBlindsWorkspace.tsx
new file mode 100644
index 0000000..bd129da
--- /dev/null
+++ b/src/components/Workspaces/CustomWorkSpaces/VenetianBlindsWorkspace/VenetianBlindsWorkspace.tsx
@@ -0,0 +1,74 @@
+import { useState } from "react";
+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";
+import { VenetianBlindsTransition } from "../../../BroadcastGraphics/Common/VenetianBlindsTransition";
+
+export function VenetianBlindsWorkspace() {
+ const { prototypeState } = useSelector(workspaceSelector);
+
+ const bgColor = prototypeState?.venetianTransition?.showBG ?? true
+ ? "black" : "transparent";
+
+ const [visible, setVisible] = useState(true);
+
+ return (
+ setVisible(!visible)} >
+ {prototypeState?.venetianTransition?.mode === "driverPortrait" ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
+ );
+}
diff --git a/src/components/Workspaces/CustomWorkSpaces/VenetianBlindsWorkspace/index.ts b/src/components/Workspaces/CustomWorkSpaces/VenetianBlindsWorkspace/index.ts
new file mode 100644
index 0000000..757738d
--- /dev/null
+++ b/src/components/Workspaces/CustomWorkSpaces/VenetianBlindsWorkspace/index.ts
@@ -0,0 +1 @@
+export * from "./VenetianBlindsWorkspace";
diff --git a/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/styles.ts b/src/components/Workspaces/CustomWorkSpaces/styles.ts
similarity index 83%
rename from src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/styles.ts
rename to src/components/Workspaces/CustomWorkSpaces/styles.ts
index 0af3649..f12e41d 100644
--- a/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/styles.ts
+++ b/src/components/Workspaces/CustomWorkSpaces/styles.ts
@@ -1,5 +1,5 @@
import styled from "styled-components";
-import { Px } from "../../../../types/style";
+import { Px } from "../../../types/style";
type BasicBlockProps = {
width: Px,
@@ -19,3 +19,4 @@ export const BasicBlock = styled.div`
border-radius: 15px;
`;
+BasicBlock.displayName = "BasicBlock";
diff --git a/src/components/Workspaces/PrototypingControls/AngledFlagPrototype/AngledFlagPrototypeControls.tsx b/src/components/Workspaces/PrototypingControls/AngledFlagPrototype/AngledFlagPrototypeControls.tsx
index 82c0baf..dbaa0fa 100644
--- a/src/components/Workspaces/PrototypingControls/AngledFlagPrototype/AngledFlagPrototypeControls.tsx
+++ b/src/components/Workspaces/PrototypingControls/AngledFlagPrototype/AngledFlagPrototypeControls.tsx
@@ -1,9 +1,8 @@
import { PadBox } from "@bedrock-layout/padbox";
import { Split } from "@bedrock-layout/split";
-import { useDispatch, useSelector } from "react-redux";
-import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
+import { useDispatch } from "react-redux";
-import { setPrototypeState } from "../../../../features/workspace/workspaceSlice";
+import { updateAngledFlagCountry, updateAngledFlagTeam } from "../../../../features/workspace/workspaceSlice";
import { FlagMode, TeamId } from "../../../../types/state";
import { SlotSelector } from "../../../Common/Inputs/SlotSelector";
@@ -17,41 +16,22 @@ const teams: Array = [
"mclaren", "mercedes", "redBull", "williams",
];
-const DEFAULT_COUNTRY = "GBR";
-const DEFAULT_TEAM: TeamId = "alfaRomeo";
-
type AngledFlagPrototypeControlsProps = {
flagMode: FlagMode,
};
export function AngledFlagPrototypeControls({ flagMode }: AngledFlagPrototypeControlsProps) {
const dispatch = useDispatch();
- const { prototypeState } = useSelector(workspaceSelector);
const flagList = flagMode === "country" ? countries : flagMode === "team" ? teams : [];
const onChange = (flag: "flagA" | "flagB") => (index: number) => {
if (flagMode === "country") {
- dispatch(setPrototypeState({
- angledFlagCountry: {
- flagA: flag === "flagA"
- ? countries[index]
- : prototypeState?.angledFlagCountry?.flagA ?? DEFAULT_COUNTRY,
- flagB: flag === "flagB"
- ? countries[index]
- : prototypeState?.angledFlagCountry?.flagB ?? DEFAULT_COUNTRY,
- },
+ dispatch(updateAngledFlagCountry({
+ [flag]: countries[index],
}));
} else if (flagMode === "team") {
- dispatch(setPrototypeState({
- angledFlagTeam: {
- flagA: flag === "flagA"
- ? teams[index]
- : prototypeState?.angledFlagTeam?.flagA ?? DEFAULT_TEAM,
- flagB: flag === "flagB"
- ? teams[index]
- : prototypeState?.angledFlagTeam?.flagB ?? DEFAULT_TEAM,
- },
+ dispatch(updateAngledFlagTeam({
+ [flag]: teams[index],
}));
-
}
};
return (
diff --git a/src/components/Workspaces/PrototypingControls/VenetianBlindsPrototype/VenetianBlindsPrototypeControls.tsx b/src/components/Workspaces/PrototypingControls/VenetianBlindsPrototype/VenetianBlindsPrototypeControls.tsx
new file mode 100644
index 0000000..787236d
--- /dev/null
+++ b/src/components/Workspaces/PrototypingControls/VenetianBlindsPrototype/VenetianBlindsPrototypeControls.tsx
@@ -0,0 +1,81 @@
+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 { DriverId } from "../../../../types/state";
+import { Corner } from "../../../../types/style";
+
+import { SlotSelector } from "../../../Common/Inputs/SlotSelector";
+import { Toggle } from "../../../Common/Inputs/Toggle";
+
+
+// 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 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],
+ }));
+ };
+
+ const onToggle = (value: boolean) => {
+ dispatch(updateVenetianTransition({
+ showBG: value,
+ }));
+ };
+
+ return (
+
+
+
+
+
+
+ );
+}
diff --git a/src/components/Workspaces/PrototypingControls/VenetianBlindsPrototype/index.ts b/src/components/Workspaces/PrototypingControls/VenetianBlindsPrototype/index.ts
new file mode 100644
index 0000000..d2f50d4
--- /dev/null
+++ b/src/components/Workspaces/PrototypingControls/VenetianBlindsPrototype/index.ts
@@ -0,0 +1 @@
+export * from "./VenetianBlindsPrototypeControls";
diff --git a/src/components/Workspaces/WorkspacesRoute.tsx b/src/components/Workspaces/WorkspacesRoute.tsx
index fcd777b..da75648 100644
--- a/src/components/Workspaces/WorkspacesRoute.tsx
+++ b/src/components/Workspaces/WorkspacesRoute.tsx
@@ -7,6 +7,7 @@ import { mainMenuDimensionsSelector } from "../../features/pageDimensions/pageDi
import { setDimensions } from "../../features/pageDimensions/pageDimensionsSlice";
import { FullScreenContainer } from "../Common/FullScreenContainer.styled";
+import { IndexHeading } from "../Common/IndexHeading.styled";
import { WorkspaceList } from "./WorkspaceList";
import { LayoutGrid, LayoutGridItem } from "../Common/LayoutGrid.styled";
@@ -15,7 +16,8 @@ import { ChyronPrototypeControls } from "./PrototypingControls/ChyronPrototype";
import { AngledFlagWorkspace } from "./CustomWorkSpaces/AngledFlagWorkspace";
import { AngledFlagPrototypeControls } from "./PrototypingControls/AngledFlagPrototype";
import { ChyronContainer } from "../BroadcastGraphics/Chyrons/Container";
-import { IndexHeading } from "../Common/IndexHeading.styled";
+import { VenetianBlindsWorkspace } from "./CustomWorkSpaces/VenetianBlindsWorkspace";
+import { VenetianBlindsPrototypeControls } from "./PrototypingControls/VenetianBlindsPrototype";
const WORKSPACE_LIST_WIDTH = 180;
@@ -78,11 +80,11 @@ export default function Workspaces() {
prototypeControls={}
/>
} />
- }
+ prototypeControls={}
/>
} />
Unknown Workspace} />
diff --git a/src/domain/data/workspaces.ts b/src/domain/data/workspaces.ts
index 603ae51..f8eb9ec 100644
--- a/src/domain/data/workspaces.ts
+++ b/src/domain/data/workspaces.ts
@@ -67,4 +67,20 @@ export const workspaces: WorkspaceObject = {
height: 500,
},
},
+ venetianTransition: {
+ name: "Venetian Transition",
+ overlayIds: [
+ "venetian-pos-1.png",
+ "venetian-pos-2.png",
+ "venetian-pos-3.png",
+ "venetian-pos-4.png",
+ "venetian-pos-5.png",
+ "venetian-pos-6.png",
+ "venetian-pos-7.png",
+ ],
+ previewWindowDimensions: {
+ width: 700,
+ height: 500,
+ },
+ },
};
diff --git a/src/features/workspace/workspaceSlice.ts b/src/features/workspace/workspaceSlice.ts
index 417a956..fad779b 100644
--- a/src/features/workspace/workspaceSlice.ts
+++ b/src/features/workspace/workspaceSlice.ts
@@ -9,7 +9,7 @@ const initialState: RootState["workspace"] = {
overlayIds: [],
previewWindowDimensions: { width: 0, height: 0 },
},
- prototypeState: null,
+ prototypeState: {},
};
export type UpdateWorkspaceAction = {
@@ -31,8 +31,54 @@ export const workspaceSlice = createSlice({
state.workspaceId = action.payload.workspaceId;
state.workspaceProperties = action.payload.workspaceProperties;
},
- setPrototypeState: (state, action: PayloadAction) => {
- state.prototypeState = action.payload;
+
+ // Prototype States
+ updateAngledFlagCountry: (
+ state,
+ action: PayloadAction>,
+ ) => {
+ if (state.prototypeState.angledFlagCountry == null) {
+ state.prototypeState.angledFlagCountry = {
+ flagA: "GBR",
+ flagB: "GBR",
+ };
+ }
+ state.prototypeState.angledFlagCountry = Object.assign(
+ state.prototypeState.angledFlagCountry,
+ action.payload,
+ );
+ },
+ updateAngledFlagTeam: (
+ state,
+ action: PayloadAction>,
+ ) => {
+ if (state.prototypeState.angledFlagTeam == null) {
+ state.prototypeState.angledFlagTeam = {
+ flagA: "alfaRomeo",
+ flagB: "alfaRomeo",
+ };
+ }
+ state.prototypeState.angledFlagTeam = Object.assign(
+ state.prototypeState.angledFlagTeam,
+ action.payload,
+ );
+ },
+ updateVenetianTransition: (
+ state,
+ action: PayloadAction>,
+ ) => {
+ if (state.prototypeState.venetianTransition == null) {
+ state.prototypeState.venetianTransition = {
+ mode: "portraitFlag",
+ subMode: "1",
+ showBG: true,
+ wipeStartingCorner: "bottomRight",
+ };
+ }
+ state.prototypeState.venetianTransition = Object.assign(
+ state.prototypeState?.venetianTransition,
+ action.payload,
+ );
},
},
});
@@ -41,6 +87,8 @@ export const {
setWorkspaceId,
setAnimatedBG,
updateWorkspace,
- setPrototypeState,
+ updateAngledFlagCountry,
+ updateAngledFlagTeam,
+ updateVenetianTransition,
} = workspaceSlice.actions;
export default workspaceSlice.reducer;
diff --git a/src/public/images/overlays/venetian-pos-1.png b/src/public/images/overlays/venetian-pos-1.png
new file mode 100644
index 0000000..ee20be6
Binary files /dev/null and b/src/public/images/overlays/venetian-pos-1.png differ
diff --git a/src/public/images/overlays/venetian-pos-2.png b/src/public/images/overlays/venetian-pos-2.png
new file mode 100644
index 0000000..461df15
Binary files /dev/null and b/src/public/images/overlays/venetian-pos-2.png differ
diff --git a/src/public/images/overlays/venetian-pos-3.png b/src/public/images/overlays/venetian-pos-3.png
new file mode 100644
index 0000000..22124ee
Binary files /dev/null and b/src/public/images/overlays/venetian-pos-3.png differ
diff --git a/src/public/images/overlays/venetian-pos-4.png b/src/public/images/overlays/venetian-pos-4.png
new file mode 100644
index 0000000..ea7764f
Binary files /dev/null and b/src/public/images/overlays/venetian-pos-4.png differ
diff --git a/src/public/images/overlays/venetian-pos-5.png b/src/public/images/overlays/venetian-pos-5.png
new file mode 100644
index 0000000..1205ecc
Binary files /dev/null and b/src/public/images/overlays/venetian-pos-5.png differ
diff --git a/src/public/images/overlays/venetian-pos-6.png b/src/public/images/overlays/venetian-pos-6.png
new file mode 100644
index 0000000..04f8ad4
Binary files /dev/null and b/src/public/images/overlays/venetian-pos-6.png differ
diff --git a/src/public/images/overlays/venetian-pos-7.png b/src/public/images/overlays/venetian-pos-7.png
new file mode 100644
index 0000000..7006a17
Binary files /dev/null and b/src/public/images/overlays/venetian-pos-7.png differ
diff --git a/src/types/state.d.ts b/src/types/state.d.ts
index 6842461..b9a1c5e 100644
--- a/src/types/state.d.ts
+++ b/src/types/state.d.ts
@@ -1,4 +1,5 @@
import { Milliseconds, Optional } from "./util";
+import { Corner } from "./style";
export interface RootState {
pageDimensions: PageDimensions;
@@ -22,7 +23,7 @@ export interface Workspace {
workspaceId: WorkspaceId;
animatedBG: boolean;
workspaceProperties: WorkspaceProperties;
- prototypeState: Optional;
+ prototypeState: PrototypeState;
}
export type WorkspaceId = string;
@@ -40,6 +41,12 @@ export interface PrototypeState {
flagA: TeamId;
flagB: TeamId;
};
+ venetianTransition?: {
+ mode: string,
+ subMode: string,
+ showBG: boolean;
+ wipeStartingCorner: Corner,
+ };
}
// Overlay Tool
diff --git a/src/types/style.d.ts b/src/types/style.d.ts
index 40800d3..8c627c5 100644
--- a/src/types/style.d.ts
+++ b/src/types/style.d.ts
@@ -4,6 +4,31 @@
export type Px = number;
/**
- * Type to remind you that we're dealing with percentages.
+ * Type to remind you that we're dealing with percentages (100 = 100%).
*/
export type Percent = number;
+
+/**
+ * Type to remind you that we're dealing with fraction (0-1).
+ */
+export type Fraction = number;
+
+/**
+ * Type to remind you that we're dealing with degrees (0-360, etc).
+ */
+export type Degrees = number;
+
+/**
+ * Object to cleanly define relative/absolute placement for a styled component.
+ */
+export interface Placement {
+ top?: string;
+ right?: string;
+ bottom?: string;
+ left?: string;
+}
+
+/**
+ * Useful to initialize movements from.
+ */
+export type Corner = "topLeft" | "topRight" | "bottomRight" | "bottomLeft";
diff --git a/src/types/util.d.ts b/src/types/util.d.ts
index 86126fb..09ccfa6 100644
--- a/src/types/util.d.ts
+++ b/src/types/util.d.ts
@@ -1,3 +1,11 @@
-export type Optional = TEntity | null;
+export type Optional = T | null;
+
+/**
+ * Type to remind you that we're dealing with milliseconds.
+ */
export type Milliseconds = number;
+
+/**
+ * Type to remind you that we're dealing with seconds.
+ */
export type Seconds = number;
diff --git a/src/utils/styling.ts b/src/utils/styling.ts
new file mode 100644
index 0000000..d94b93e
--- /dev/null
+++ b/src/utils/styling.ts
@@ -0,0 +1,62 @@
+import { css }from "styled-components";
+import { clamp } from "lodash";
+
+import { Corner, Fraction, Placement, Px } from "../types/style";
+
+export function placementStyleRules(pos: Placement) {
+ return css`
+ ${pos.top ? `top: ${pos.top};` : ""}
+ ${pos.right ? `right: ${pos.right};` : ""}
+ ${pos.bottom ? `bottom: ${pos.bottom};` : ""}
+ ${pos.left ? `left: ${pos.left};` : ""}
+ `;
+}
+
+
+/**
+ * Provides the x, y coordinates of a three point polygon for use in a clip-path
+ * mask. By taking a fraction to indicate the progress through the animation it
+ * will return the six coordinates that will generate a wipe effect.
+ * @param width element width in pixels
+ * @param height element height in pixels
+ * @param progress fraction from 0 to 1
+ * @param startingCorner Which corner the wipe originates from
+ * @param degrees The angle in degrees of the wipe
+ * @returns Array of six numbers representing pixel values of the clip-path
+ */
+export function wipeCustomDegClip(
+ width: Px,
+ height: Px,
+ progress: Fraction,
+ startingCorner: Corner,
+ degrees: number,
+): [Px, Px, Px, Px, Px, Px] {
+ const tangent = Math.tan(clamp(degrees, 0.01, 90) * Math.PI / 180);
+
+ switch (startingCorner) {
+ case "topLeft":
+ return [
+ 0, 0,
+ (width + height / tangent) * progress, 0,
+ 0, (height + width * tangent) * progress ,
+ ];
+ case "topRight":
+ return [
+ width, 0,
+ width, (height + width * tangent) * progress,
+ width - (width + height / tangent) * progress, 0,
+ ];
+ case "bottomRight":
+ return [
+ width, height,
+ width, height - (height + width * tangent) * progress,
+ width - (width + height / tangent) * progress, height,
+ ];
+ case "bottomLeft":
+ return [
+ 0, height,
+ 0, height - (height + width * tangent) * progress,
+ (width + height / tangent) * progress, height,
+ ];
+ }
+}