diff --git a/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx b/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx
index 7e1a02e..5c5235e 100644
--- a/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx
+++ b/src/components/Broadcast/BroadcastDirectorUI/Chyrons/ChyronsDirectorControls.tsx
@@ -3,14 +3,14 @@ import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Stack } from "@bedrock-layout/stack";
import { Inline } from "@bedrock-layout/inline";
-import { FaPlay, FaStepForward, FaStop } from "react-icons/fa";
+import { FaCheck, FaStepForward, FaTimes } from "react-icons/fa";
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
import { broadcastDirectorSelector } from "../../../../features/broadcast/director/broadcastDirectorSelector";
import {
- chyronsClear,
- chyronsOpenStateIncrement,
- chyronsSet,
+ incrementChyronsOpenState,
+ setChyrons,
+ setChyronsOpenState,
} from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
import { flagModeList, getChyronModesList, getChyronSubModesList } from "../../../../domain/data/broadcastGraphics";
import { BGChyronDriver, BGChyronMode, BGChyrons, BGChyronSubMode, Car, FlagMode } from "../../../../types/state";
@@ -37,42 +37,49 @@ export function ChyronsDirectorControls() {
const { chyrons } = useSelector(broadcastGraphicsSelector);
const { selectedCars } = useSelector(broadcastDirectorSelector);
+ // Handle changes to the chyron mode so submodes can be changed accordingly.
useEffect(() => {
setChyronSubModes(getChyronSubModesList(chyronMode));
}, [chyronMode]);
const onOpen = () => {
- if (chyronMode === "driver") {
- if (selectedCars.length === 0) return;
- let primaryCar = selectedCars[0];
- let secondaryCar = selectedCars.length > 1 ? selectedCars[1] : null;
-
- // Auto-sort drivers by position so trailing car always appears second.
- if (chyronSubMode === "medium" && secondaryCar != null
- && secondaryCar.position < primaryCar.position) {
- secondaryCar = selectedCars[0];
- primaryCar = selectedCars[1];
- }
- const newChyrons: BGChyrons = {
- openState: 1,
- relativePos: { top: "0", right: "0", bottom: "0", left: "0" },
- mode: chyronMode,
- subMode: chyronSubMode,
- driver: {
- primary: buildDriverChyron(primaryCar),
- secondary: secondaryCar != null ? buildDriverChyron(secondaryCar) : null,
- },
- };
- dispatch(chyronsSet(newChyrons));
- }
+ buildDriver();
+ setTimeout(() => {
+ // Delay a short time and increment the open state so the animation can happen.
+ dispatch(incrementChyronsOpenState());
+ }, 50);
};
const onNext = () => {
- dispatch(chyronsOpenStateIncrement());
+ dispatch(incrementChyronsOpenState());
};
const onClose = () => {
- dispatch(chyronsClear());
+ dispatch(setChyronsOpenState(-1));
+ };
+
+ const buildDriver = () => {
+ if (selectedCars.length === 0) return;
+ let primaryCar = selectedCars[0];
+ let secondaryCar = selectedCars.length > 1 ? selectedCars[1] : null;
+
+ // Auto-sort drivers by position so trailing car always appears second.
+ if (chyronSubMode === "medium" && secondaryCar != null
+ && secondaryCar.position < primaryCar.position) {
+ secondaryCar = selectedCars[0];
+ primaryCar = selectedCars[1];
+ }
+ const newChyrons: BGChyrons = {
+ openState: 0,
+ relativePos: { top: "0", right: "0", bottom: "0", left: "0" },
+ mode: chyronMode,
+ subMode: chyronSubMode,
+ driver: {
+ primary: buildDriverChyron(primaryCar),
+ secondary: secondaryCar != null ? buildDriverChyron(secondaryCar) : null,
+ },
+ };
+ dispatch(setChyrons(newChyrons));
};
const buildDriverChyron = (car: Car): BGChyronDriver => ({
@@ -136,19 +143,19 @@ export function ChyronsDirectorControls() {
onClick={onOpen}
disabled={chyrons != null}
>
-
+
-
+
diff --git a/src/components/BroadcastGraphics/Chyrons/Container/ChyronContainer.tsx b/src/components/BroadcastGraphics/Chyrons/Container/ChyronContainer.tsx
index 908d367..6766c0f 100644
--- a/src/components/BroadcastGraphics/Chyrons/Container/ChyronContainer.tsx
+++ b/src/components/BroadcastGraphics/Chyrons/Container/ChyronContainer.tsx
@@ -1,12 +1,17 @@
import { useSelector } from "react-redux";
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
+import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
import { ChyronDriver } from "../Driver";
import { DoubleChyronContainer } from "./styles";
-export function ChyronContainer() {
+type ChyronContainerProps = {
+ debug?: boolean,
+};
+export function ChyronContainer({ debug = false }: ChyronContainerProps) {
const { chyrons } = useSelector(broadcastGraphicsSelector);
+ const { debugDurationMultiplier } = useSelector(workspaceSelector);
if (chyrons == null || chyrons.driver == null) return null;
@@ -14,6 +19,8 @@ export function ChyronContainer() {
);
if (chyrons.subMode === "medium" && chyrons.driver.secondary) {
@@ -23,6 +30,8 @@ export function ChyronContainer() {
);
diff --git a/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx b/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx
index 61b94ba..e151d84 100644
--- a/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx
+++ b/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx
@@ -1,55 +1,172 @@
-import { BGChyronDriver, BGChyronSubMode } from "../../../../types/state";
+import { useSpring } from "@react-spring/web";
+import { useDispatch } from "react-redux";
+import { BGChyronDriver, BGChyronSubMode, OpenState } from "../../../../types/state";
+import { Fraction } from "../../../../types/style";
+import { clearChyrons } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
import { theme } from "../../../../shared/theme";
+import { outlineClipPath } from "../../../../utils/styling";
import { DriverNumber } from "../../Common/DriverNumber";
import { AngledFlag } from "../../Common/AngledFlag";
+import { PositionFlag } from "../../Common/PositionFlag";
+import { DriverPortrait } from "../../Common/DriverPortrait";
import {
- BaseBackground,
+ AnimatedBaseContainer,
+ BaseLayout,
+ AnimatedBaseOutline,
+ BaseBlack,
+ BaseBackgroundColor,
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);
+import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition";
type ChyronDriverProps = {
chyronData: BGChyronDriver,
subMode: BGChyronSubMode,
+ openState: OpenState,
+ debugDurationMultiplier?: Fraction,
};
-export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
+export function ChyronDriver({
+ chyronData,
+ subMode,
+ openState,
+ debugDurationMultiplier: DDM = 1.0,
+}: ChyronDriverProps) {
const [baseWidth, baseHeight] = subMode === "medium" ? [582, 72]
: subMode === "large" ? [638, 98]
: [0, 0];
const { car, flagMode, showPosFlag, showDriverNumber, showPortrait } = chyronData;
+
const flagProps = flagMode === "country"
? { flagMode, flag: car.driver.nationality }
- : flagMode === "team" ? { flagMode, flag: car.driver.team.id } : undefined;
+ : flagMode === "team"
+ ? { flagMode, flag: car.driver.team.id }
+ : undefined;
+
+ const dispatch = useDispatch();
+
+ const containerFadeAwaySpring = useSpring({
+ opacity: openState == -1 ? 0 : 1,
+ config: { duration: 300 * DDM },
+ delay: 0,
+ onRest: () => {
+ if (openState === -1) {
+ dispatch(clearChyrons());
+ }
+ },
+ });
+
+ const { outlineClipPathProgress } = useSpring({
+ outlineClipPathProgress: openState !== 0 ? 1 : 0,
+ config: { duration: 500 * DDM },
+ delay: 0,
+ });
+
+ const teamColor = theme.colors.teams[car.driver.team.id];
return (
-
-
+
+ {
+ const coordinates = outlineClipPath(
+ baseWidth,
+ baseHeight,
+ progress,
+ 5,
+ );
+ return `polygon(${coordinates.map(([x, y]) => `${x}px ${y}px`).join(", ")})`;
+ }),
+ }}
+ />
+
+
+
{showPosFlag && (
-
-
- {car.position}
-
-
+
+
+
)}
-
+
@@ -65,9 +182,25 @@ export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
)}
- {car.driver.team.shortName}
+
+ {car.driver.team.shortName}
+
)}
-
+
{showPortrait && (
-
+
+
+
+
+
)}
-
+
);
}
diff --git a/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts b/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts
index 97ca527..eca70e3 100644
--- a/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts
+++ b/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts
@@ -1,68 +1,109 @@
-import styled from "styled-components";
-import { Px } from "../../../../types/style";
+import { animated } from "@react-spring/web";
+import styled, { css, keyframes } from "styled-components";
-type BaseContainerProps = {
+import { Placement, Px, TransitionArgs } from "../../../../types/style";
+import { Milliseconds } from "../../../../types/util";
+import { commonTransition, placementStyleRules } from "../../../../utils/styling";
+
+type OpenProps = {
+ open: boolean,
+};
+type TransitionProps = OpenProps & {
+ transitionProps: TransitionArgs[],
+};
+
+type AnimatedBaseContainerProps = {
width: Px,
height: Px,
};
-export const BaseContainer = styled.div`
+export const AnimatedBaseContainer = animated(styled.div`
position: relative;
width: ${({ width }) => `${width}px`};
height: ${({ height }) => `${height}px`};
-`;
-BaseContainer.displayName = "BaseContainer";
+`);
+AnimatedBaseContainer.displayName = "AnimatedBaseContainer";
-export const BaseBackground = styled.div`
- position: relative;
+const BaseShape = styled.div`
+ position: absolute;
+ height: 100%;
+ border-bottom-right-radius: 11px;
+`;
+
+type AnimatedBaseOutlineProps = TransitionProps & {
+ startThickness: Px,
+ endThickness: Px,
+ startColor: string,
+ endColor: string,
+};
+export const AnimatedBaseOutline = animated(styled(BaseShape)`
+ width: 100%;
+ opacity: ${({ open }) => open ? 1 : 0};
+ outline: ${({ open, startThickness, endThickness, startColor, endColor }) => open
+ ? `${endThickness}px solid ${endColor}`
+ : `${startThickness}px solid ${startColor}`};
+
+ ${({ transitionProps }) => commonTransition(transitionProps)}
+`);
+AnimatedBaseOutline.displayName = "AnimatedBaseOutline";
+
+export const BaseBlack = styled(BaseShape)`
+ opacity: ${({ open }) => open ? 1 : 0.1};
+ width: ${({ open }) => open ? 100 : 0}%;
+
+ background-color: black;
+
+ ${({ transitionProps }) => commonTransition(transitionProps)}
+`;
+BaseBlack.displayName = "BaseBlack";
+
+type BaseBackgroundColorProps = {
+ teamColor: string,
+};
+export const BaseBackgroundColor = styled(BaseShape)`
+ width: 100%;
+
+ background-color: ${({ teamColor }) => teamColor};
+ opacity: ${({ open }) => open ? 0 : 1};
+
+ ${({ transitionProps }) => commonTransition(transitionProps)}
+`;
+BaseBackgroundColor.displayName = "BaseBackgroundColor";
+
+export const BaseLayout = styled(BaseShape)`
+ position: absolute;
height: 100%;
width: 100%;
display: flex;
align-items: center;
- border-bottom-right-radius: 11px;
- background-color: #000;
-
overflow: hidden;
+
+ clip-path: ${({ open }) => open
+ ? "polygon(0 0, 100% 0, 100% 100%, 0 100%)"
+ : "polygon(0 0, 0 0, -40% 100%, -40% 100%)"};
+
+ ${({ transitionProps }) => commonTransition(transitionProps)}
`;
-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";
+BaseLayout.displayName = "BaseLayout";
type TeamColorBarProps = {
color: string,
};
-export const TeamColorBar = styled.div`
+export const TeamColorBar = styled.div`
position: relative;
width: 1%; // 6px;
height: 63%;
background-color: ${({ color }) => color};
+
+ clip-path: ${({ open }) => open
+ ? "polygon(0 0, 100% 0, 100% 100%, 0 100%)"
+ : "polygon(-100% 0, 200% 0, 200% 0, -100% 0)"};
+
+ outline: ${({ color }) => color} solid 1px;
+
+ ${({ transitionProps }) => commonTransition(transitionProps)}
`;
TeamColorBar.displayName = "TeamColorBar";
@@ -106,11 +147,27 @@ export const NumberContainer = styled.div`
`;
NumberContainer.displayName = "NumberContainer";
-export const TeamName = styled.div`
+const blinkingAnimation = keyframes`
+ 0% { opacity: 0.4 }
+ 14% { opacity: 0 }
+ 42% { opacity: 0.4 }
+ 56% { opacity: 0 }
+ 86% { opacity: 1 }
+`;
+
+type TeamNameProps = OpenProps & {
+ duration: Milliseconds,
+ delay: Milliseconds,
+}
+export const TeamName = styled.div`
position: relative;
font-family: ${p => p.theme.fonts.f1Regular};
color: #d1d1d1;
font-size: 20px;
+
+ ${({ open, duration, delay }) => open && css`
+ animation: ${blinkingAnimation} ${duration}ms step-end ${delay}ms;
+ `}
`;
TeamName.displayName = "TeamName";
@@ -129,9 +186,10 @@ type FlagContainerProps = {
width: Px,
right: Px,
};
-export const FlagContainer = styled.div`
+export const FlagContainer = styled.div`
position: absolute;
- right: ${({ right }) => `${right}px`};
+ right: ${({ right, open }) => open ? right : right * -3}px;
+ z-index: -1;
display: flex;
align-items: center;
@@ -141,26 +199,22 @@ export const FlagContainer = styled.div`
width: ${({ width }) => `${width}px`};
overflow: hidden;
+
+ opacity: ${({ open }) => open ? 1 : 0};
+
+ ${({ transitionProps }) => commonTransition(transitionProps)}
`;
FlagContainer.displayName = "FlagContainer";
-type PortraitDivProps = {
- src: string,
- height: Px,
- rightMargin: Px,
+type DriverPortraitContainerProps = TransitionProps & {
+ placement: Placement,
};
-export const PortraitDiv = styled.div`
+export const DriverPortraitContainer = styled.div`
position: absolute;
- height: ${({ height }) => `${height}px`};
- width: ${({ height }) => `${height * 1.4}px`};
+ ${({ placement }) => placementStyleRules(placement)}
- 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`};
+ opacity: ${({ open }) => open ? 1 : 0};
+ ${({ transitionProps }) => commonTransition(transitionProps)}
`;
-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..759db5e
--- /dev/null
+++ b/src/components/BroadcastGraphics/Common/VenetianBlindsTransition/VenetianBlindsTransition.tsx
@@ -0,0 +1,122 @@
+import { useSpring, animated, easings } 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,
+ easing: easings.easeInOutQuint,
+ },
+ 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 coordinates = wipeCustomDegClip(
+ childWidth,
+ childHeight,
+ wipeProgress,
+ wipeStartingCorner,
+ wipeAngle,
+ );
+ return `polygon(${coordinates.map(([x, y]) => `${x}px ${y}px`).join(", ")})`;
+ }),
+ }}
+ 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.tsx b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/AngledFlagWorkspace.tsx
similarity index 77%
rename from src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkSpace.tsx
rename to src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/AngledFlagWorkspace.tsx
index cf9244e..3ce1e9c 100644
--- a/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkSpace.tsx
+++ b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/AngledFlagWorkspace.tsx
@@ -1,15 +1,15 @@
import { useSelector } from "react-redux";
-import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
-import { FlagMode, TeamId } from "../../../types/state";
+import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
+import { FlagMode, TeamId } from "../../../../types/state";
-import { AngledFlag } from "../../BroadcastGraphics/Common/AngledFlag";
-import { BasicBlock } from "./styles";
+import { AngledFlag } from "../../../BroadcastGraphics/Common/AngledFlag";
+import { BasicBlock } from "../styles";
-type AngledFlagWorkSpaceProps = {
+type AngledFlagWorkspaceProps = {
flagMode: FlagMode,
};
-export function AngledFlagWorkSpace({ flagMode }: AngledFlagWorkSpaceProps) {
+export function AngledFlagWorkspace({ flagMode }: AngledFlagWorkspaceProps) {
const { prototypeState } = useSelector(workspaceSelector);
if (flagMode === "none") return null;
diff --git a/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/index.ts b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/index.ts
new file mode 100644
index 0000000..57bb47b
--- /dev/null
+++ b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkspace/index.ts
@@ -0,0 +1 @@
+export * from "./AngledFlagWorkspace";
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/styles.ts b/src/components/Workspaces/CustomWorkSpaces/styles.ts
index b57472e..f12e41d 100644
--- a/src/components/Workspaces/CustomWorkSpaces/styles.ts
+++ b/src/components/Workspaces/CustomWorkSpaces/styles.ts
@@ -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/GridSelection/GridSelection.tsx b/src/components/Workspaces/PrototypingControls/GridSelection/GridSelection.tsx
index 9f6b7a7..7b53399 100644
--- a/src/components/Workspaces/PrototypingControls/GridSelection/GridSelection.tsx
+++ b/src/components/Workspaces/PrototypingControls/GridSelection/GridSelection.tsx
@@ -3,7 +3,7 @@ import { findIndex } from "lodash";
import { useDispatch, useSelector } from "react-redux";
import { broadcastDirectorSelector } from "../../../../features/broadcast/director/broadcastDirectorSelector";
-import { selectedCarsAdd, selectedCarsClear, selectedCarsRemove } from "../../../../features/broadcast/director/broadcastDirectorSlice";
+import { pushSelectedCars, clearSelectedCars, removeSelectedCars } from "../../../../features/broadcast/director/broadcastDirectorSlice";
import { eventSelector } from "../../../../features/event/eventSelector";
import { Car } from "../../../../types/state";
import { carMatch } from "../../../../utils/comparators";
@@ -21,13 +21,13 @@ export function GridSelection() {
const carClick = (car: Car, selected: boolean) => () => {
if (selected) {
- dispatch(selectedCarsRemove(car));
+ dispatch(removeSelectedCars(car));
} else {
- dispatch(selectedCarsAdd(car));
+ dispatch(pushSelectedCars(car));
}
};
const carDoubleClick = (car: Car) => () => {
- dispatch(selectedCarsClear(car));
+ dispatch(clearSelectedCars(car));
};
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/Workspace/Workspace.tsx b/src/components/Workspaces/Workspace/Workspace.tsx
index e4ce926..98c02cd 100644
--- a/src/components/Workspaces/Workspace/Workspace.tsx
+++ b/src/components/Workspaces/Workspace/Workspace.tsx
@@ -19,14 +19,16 @@ type WorkspaceProps = {
workspaceId: WorkspaceId,
previewContent: ReactNode,
prototypeControls: ReactNode,
+ showAnimationSpeedSelector?: boolean,
};
export const Workspace = ({
workspaceId,
previewContent,
prototypeControls,
+ showAnimationSpeedSelector = false,
}: WorkspaceProps) => {
const dispatch = useDispatch();
- const { animatedBG, workspaceProperties } = useSelector(workspaceSelector);
+ const { animatedBG, darkBG, workspaceProperties } = useSelector(workspaceSelector);
const { currentWorkspaceId: overlayWorkspaceId } = useSelector(overlayToolSelector);
useEffect(() => {
@@ -56,6 +58,7 @@ export const Workspace = ({
{previewContent}
-
+
{prototypeControls}
diff --git a/src/components/Workspaces/Workspace/styles.ts b/src/components/Workspaces/Workspace/styles.ts
index 8a270ba..8cadbac 100644
--- a/src/components/Workspaces/Workspace/styles.ts
+++ b/src/components/Workspaces/Workspace/styles.ts
@@ -1,9 +1,11 @@
import styled, { css, keyframes } from "styled-components";
import { PadBox } from "@bedrock-layout/padbox";
-import bg from "../../../public/images/misc/checker-40x40.png";
import { Dimensions } from "../../../types/state";
+import bgLight from "../../../public/images/misc/checker-40x40-light.png";
+import bgDark from "../../../public/images/misc/checker-40x40-dark.png";
+
const scrollAnimation = keyframes`
from { background-position: 0 0; }
to { background-position: 80px -40px; }
@@ -12,6 +14,7 @@ const scrollAnimation = keyframes`
export type PreviewWindowProps = {
dimensions: Dimensions,
animatedBG?: boolean,
+ darkBG?: boolean,
};
export const PreviewWindow = styled.div`
position: relative;
@@ -24,7 +27,7 @@ export const PreviewWindow = styled.div`
border-radius: 1em;
- background-image: url("${bg}");
+ background-image: url("${({ darkBG }) => darkBG ? bgDark : bgLight}");
background-position: 0px 0px;
background-repeat: repeat;
diff --git a/src/components/Workspaces/WorkspaceControls/WorkspaceControls.tsx b/src/components/Workspaces/WorkspaceControls/WorkspaceControls.tsx
index 406d9be..26062db 100644
--- a/src/components/Workspaces/WorkspaceControls/WorkspaceControls.tsx
+++ b/src/components/Workspaces/WorkspaceControls/WorkspaceControls.tsx
@@ -1,28 +1,56 @@
-import { Grid } from "@bedrock-layout/grid";
+import { InlineCluster } from "@bedrock-layout/inline-cluster";
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 { setAnimatedBG } from "../../../features/workspace/workspaceSlice";
+import { setAnimatedBG, setDarkBG, setDebugDurationMultiplier } from "../../../features/workspace/workspaceSlice";
+import { SlotSelector } from "../../Common/Inputs/SlotSelector";
import { Toggle } from "../../Common/Inputs/Toggle";
import { OverlayControl } from "../../OverlayTool";
-export const WorkspaceControls = () => {
+const debugMultipliers = ["1", "1.5", "2", "3", "5", "10"];
+
+
+type WorkspaceControlsProps = {
+ showAnimationSpeedSelector?: boolean,
+};
+export const WorkspaceControls = (
+ { showAnimationSpeedSelector = false }: WorkspaceControlsProps,
+) => {
const dispatch = useDispatch();
- const { animatedBG } = useSelector(workspaceSelector);
+ const { animatedBG, darkBG } = useSelector(workspaceSelector);
return(
-
-
+
+
{
dispatch(setAnimatedBG(value));
- }} />
-
+ }}
+ />
+ {
+ dispatch(setDarkBG(value));
+ }}
+ />
+ {showAnimationSpeedSelector && (
+ `x${value}`}
+ onChange={index =>
+ dispatch(setDebugDurationMultiplier(parseFloat(debugMultipliers[index])))}
+ slotWidth="4ch"
+ />
+ )}
+
-
+
);
};
diff --git a/src/components/Workspaces/WorkspacesRoute.tsx b/src/components/Workspaces/WorkspacesRoute.tsx
index af8586d..34e33e5 100644
--- a/src/components/Workspaces/WorkspacesRoute.tsx
+++ b/src/components/Workspaces/WorkspacesRoute.tsx
@@ -7,15 +7,17 @@ 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";
import { Workspace } from "./Workspace";
import { ChyronPrototypeControls } from "./PrototypingControls/ChyronPrototype";
-import { AngledFlagWorkSpace } from "./CustomWorkSpaces/AngledFlagWorkSpace";
+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;
@@ -53,32 +55,41 @@ export default function Workspaces() {
}
+ previewContent={}
prototypeControls={}
+ showAnimationSpeedSelector
/>
} />
}
+ previewContent={}
prototypeControls={}
+ showAnimationSpeedSelector
/>
} />
}
+ previewContent={}
prototypeControls={}
/>
} />
}
+ previewContent={}
prototypeControls={}
/>
} />
- Unknown Workspace} />
+ }
+ prototypeControls={}
+ />
+ } />
+ Unknown Workspace} />
diff --git a/src/domain/data/workspaces.ts b/src/domain/data/workspaces.ts
index 603ae51..4268687 100644
--- a/src/domain/data/workspaces.ts
+++ b/src/domain/data/workspaces.ts
@@ -13,6 +13,7 @@ export const workspaces: WorkspaceObject = {
"chyron-driver-medium-full-vet.png",
"chyron-driver-medium-full-per.png",
"chyron-driver-medium-full-msc.png",
+ "chyron-driver-medium-op0-ham.png",
"chyron-driver-medium-op1-ham.png",
"chyron-driver-medium-op2-ham.png",
"chyron-driver-medium-full-ham.png",
@@ -67,4 +68,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/broadcast/director/broadcastDirectorSlice.ts b/src/features/broadcast/director/broadcastDirectorSlice.ts
index 5bd72aa..238e42d 100644
--- a/src/features/broadcast/director/broadcastDirectorSlice.ts
+++ b/src/features/broadcast/director/broadcastDirectorSlice.ts
@@ -13,16 +13,16 @@ export const broadcastDirectorSlice = createSlice({
name: "broadcastDirector",
initialState,
reducers: {
- selectedCarsAdd: (state, action: PayloadAction) => {
+ pushSelectedCars: (state, action: PayloadAction) => {
const index = findIndex(state.selectedCars, carMatch(action.payload));
if (index === -1) {
state.selectedCars = state.selectedCars.concat(action.payload);
}
},
- selectedCarsSet: (state, action: PayloadAction) => { // Might be removed.
+ setSelectedCars: (state, action: PayloadAction) => { // Might be removed.
state.selectedCars = [action.payload];
},
- selectedCarsRemove: (state, action: PayloadAction) => {
+ removeSelectedCars: (state, action: PayloadAction) => {
const index = typeof action.payload === "number"
? action.payload
: findIndex(state.selectedCars, carMatch(action.payload));
@@ -36,7 +36,7 @@ export const broadcastDirectorSlice = createSlice({
* car.
* @param action Car (optional)
*/
- selectedCarsClear: (state, action: PayloadAction>) => {
+ clearSelectedCars: (state, action: PayloadAction>) => {
if (action.payload == null) {
state.selectedCars = [];
} else {
@@ -47,9 +47,9 @@ export const broadcastDirectorSlice = createSlice({
});
export const {
- selectedCarsAdd,
- selectedCarsSet,
- selectedCarsRemove,
- selectedCarsClear,
+ pushSelectedCars,
+ setSelectedCars,
+ removeSelectedCars,
+ clearSelectedCars,
} = broadcastDirectorSlice.actions;
export default broadcastDirectorSlice.reducer;
diff --git a/src/features/broadcast/graphics/broadcastGraphicsSlice.ts b/src/features/broadcast/graphics/broadcastGraphicsSlice.ts
index d5acc27..a169905 100644
--- a/src/features/broadcast/graphics/broadcastGraphicsSlice.ts
+++ b/src/features/broadcast/graphics/broadcastGraphicsSlice.ts
@@ -10,10 +10,10 @@ export const broadcastGraphicsSlice = createSlice({
name: "broadcastGraphics",
initialState,
reducers: {
- chyronsSet: (state, action: PayloadAction) => {
+ setChyrons: (state, action: PayloadAction) => {
state.chyrons = action.payload;
},
- chyronsOpenStateSet: (state, action: PayloadAction) => {
+ setChyronsOpenState: (state, action: PayloadAction) => {
if (state.chyrons == null) return;
state.chyrons.openState = action.payload;
@@ -21,7 +21,7 @@ export const broadcastGraphicsSlice = createSlice({
state.chyrons.openState = action.payload;
}
},
- chyronsOpenStateIncrement: (state) => {
+ incrementChyronsOpenState: (state) => {
if (state.chyrons == null) return;
++state.chyrons.openState;
@@ -29,16 +29,16 @@ export const broadcastGraphicsSlice = createSlice({
++state.chyrons.openState;
}
},
- chyronsClear: (state) => {
+ clearChyrons: (state) => {
state.chyrons = null;
},
},
});
export const {
- chyronsSet,
- chyronsOpenStateSet,
- chyronsOpenStateIncrement,
- chyronsClear,
+ setChyrons,
+ setChyronsOpenState,
+ incrementChyronsOpenState,
+ clearChyrons,
} = broadcastGraphicsSlice.actions;
export default broadcastGraphicsSlice.reducer;
diff --git a/src/features/event/eventSlice.ts b/src/features/event/eventSlice.ts
index 108ded2..4ad46cd 100644
--- a/src/features/event/eventSlice.ts
+++ b/src/features/event/eventSlice.ts
@@ -46,13 +46,13 @@ export const eventSlice = createSlice({
name: "event",
initialState,
reducers: {
- courseFlagSet: (state, action: PayloadAction) => {
+ setCourseFlag: (state, action: PayloadAction) => {
state.courseStatus.courseFlag = action.payload;
},
},
});
export const {
- courseFlagSet,
+ setCourseFlag,
} = eventSlice.actions;
export default eventSlice.reducer;
diff --git a/src/features/workspace/workspaceSlice.ts b/src/features/workspace/workspaceSlice.ts
index 417a956..0944daa 100644
--- a/src/features/workspace/workspaceSlice.ts
+++ b/src/features/workspace/workspaceSlice.ts
@@ -1,15 +1,18 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { PrototypeState, RootState, WorkspaceId, WorkspaceProperties } from "../../types/state";
+import { Fraction } from "../../types/style";
const initialState: RootState["workspace"] = {
workspaceId: "",
animatedBG: true,
+ darkBG: false,
+ debugDurationMultiplier: 1.0,
workspaceProperties: {
name: "undefined",
overlayIds: [],
previewWindowDimensions: { width: 0, height: 0 },
},
- prototypeState: null,
+ prototypeState: {},
};
export type UpdateWorkspaceAction = {
@@ -27,12 +30,64 @@ export const workspaceSlice = createSlice({
setAnimatedBG: (state, action: PayloadAction) => {
state.animatedBG = action.payload;
},
+ setDarkBG: (state, action: PayloadAction) => {
+ state.darkBG = action.payload;
+ },
+ setDebugDurationMultiplier: (state, action: PayloadAction) => {
+ state.debugDurationMultiplier = action.payload;
+ },
updateWorkspace: (state, action: PayloadAction) => {
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,
+ );
},
},
});
@@ -40,7 +95,11 @@ export const workspaceSlice = createSlice({
export const {
setWorkspaceId,
setAnimatedBG,
+ setDarkBG,
+ setDebugDurationMultiplier,
updateWorkspace,
- setPrototypeState,
+ updateAngledFlagCountry,
+ updateAngledFlagTeam,
+ updateVenetianTransition,
} = workspaceSlice.actions;
export default workspaceSlice.reducer;
diff --git a/src/public/images/misc/checker-40x40-dark.png b/src/public/images/misc/checker-40x40-dark.png
new file mode 100644
index 0000000..ca3c698
Binary files /dev/null and b/src/public/images/misc/checker-40x40-dark.png differ
diff --git a/src/public/images/misc/checker-40x40.png b/src/public/images/misc/checker-40x40-light.png
similarity index 100%
rename from src/public/images/misc/checker-40x40.png
rename to src/public/images/misc/checker-40x40-light.png
diff --git a/src/public/images/overlays/chyron-driver-medium-op0-ham.png b/src/public/images/overlays/chyron-driver-medium-op0-ham.png
new file mode 100644
index 0000000..7cd86d9
Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-op0-ham.png differ
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..c01dc92 100644
--- a/src/types/state.d.ts
+++ b/src/types/state.d.ts
@@ -1,4 +1,5 @@
import { Milliseconds, Optional } from "./util";
+import { Corner, Fraction } from "./style";
export interface RootState {
pageDimensions: PageDimensions;
@@ -21,8 +22,10 @@ export interface Dimensions { width: number; height: number; }
export interface Workspace {
workspaceId: WorkspaceId;
animatedBG: boolean;
+ darkBG: boolean;
+ debugDurationMultiplier: Fraction,
workspaceProperties: WorkspaceProperties;
- prototypeState: Optional;
+ prototypeState: PrototypeState;
}
export type WorkspaceId = string;
@@ -40,6 +43,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..64e22dd 100644
--- a/src/types/style.d.ts
+++ b/src/types/style.d.ts
@@ -4,6 +4,39 @@
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";
+
+
+export interface TransitionArgs {
+ property?: string,
+ duration?: Milliseconds,
+ timing?: string
+ delay?: Milliseconds,
+}
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..de184de
--- /dev/null
+++ b/src/utils/styling.ts
@@ -0,0 +1,135 @@
+import { css }from "styled-components";
+import { clamp } from "lodash";
+
+import { Corner, Fraction, Placement, Px, TransitionArgs } 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],
+ ];
+ }
+}
+
+export function commonTransition(propsArray: TransitionArgs[]) {
+ return (
+ "transition: "
+ + propsArray.map(p => `
+ ${p?.property ?? "all"} ${p?.duration ?? 1000}ms ${p?.timing ?? ""} ${p?.delay ?? 0}ms
+ `).join(", ")
+ + ";"
+ );
+}
+
+/**
+ * Provides the x, y coordinates of a six 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 outlineThickness the expected max width of the outline
+ * @returns
+ */
+export function outlineClipPath(
+ width: Px,
+ height: Px,
+ progress: Fraction,
+ outlineThickness: Px,
+): [[Px, Px], [Px, Px], [Px, Px], [Px, Px], [Px, Px], [Px, Px]] {
+ const travelDistance = width * 2 + height;
+ const pt1End = width / travelDistance;
+ const pt2End = (width + height) / travelDistance;
+
+ // Part 1: Reveal the bottom line.
+ if (progress <= pt1End) {
+ const x = width * progress / pt1End;
+ return [
+ [0, height],
+ [0, height],
+ [0, height],
+ [x, height],
+ [x, height + outlineThickness],
+ [0, height + outlineThickness],
+ ];
+
+ // Part 2: Reveal the right line.
+ } else if (progress > pt1End && progress <= pt2End) {
+ const y = height - (height + outlineThickness) * ((progress - pt1End) / (pt2End - pt1End));
+ return [
+ [0, height],
+ [width - 10, height],
+ [width, y],
+ [width + outlineThickness, y],
+ [width + outlineThickness, height + outlineThickness],
+ [0, height + outlineThickness],
+ ];
+
+ // Part 3: Reveal the top line.
+ } else {
+ const x = width - width * ((progress - pt2End) / (1 - pt2End));
+ return [
+ [0, height],
+ [x - 10, height],
+ [x, -outlineThickness],
+ [width + outlineThickness, -outlineThickness],
+ [width + outlineThickness, height + outlineThickness],
+ [0, height + outlineThickness],
+ ];
+ }
+
+
+ // return [
+
+ // ]
+}