10 files changed
+380
-128
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import { animated, easings, useSpring } from "@react-spring/web";
|
import { animated, easings, useSpring } from "@react-spring/web";
|
||||||
import useMeasure from "react-use-measure";
|
import useMeasure from "react-use-measure";
|
||||||
|
|
||||||
import { Corner, Degrees, Fraction } from "../../../../types/style";
|
import { Corner, Degrees, Fraction, Px } from "../../../../types/style";
|
||||||
import { Milliseconds } from "../../../../types/util";
|
import { Milliseconds } from "../../../../types/util";
|
||||||
import { wipeCustomDegClip } from "../../../../utils/styling";
|
import { wipeCustomDegClip } from "../../../../utils/styling";
|
||||||
|
|
||||||
@@ -14,6 +14,10 @@ type WipeTransitionProps = {
|
|||||||
opacityStart?: Fraction,
|
opacityStart?: Fraction,
|
||||||
opacityDuration?: Milliseconds,
|
opacityDuration?: Milliseconds,
|
||||||
opacityDelay?: Milliseconds,
|
opacityDelay?: Milliseconds,
|
||||||
|
manualDimensions?: {
|
||||||
|
height: Px,
|
||||||
|
width: Px,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export function WipeTransition({
|
export function WipeTransition({
|
||||||
@@ -25,6 +29,7 @@ export function WipeTransition({
|
|||||||
opacityStart = 1,
|
opacityStart = 1,
|
||||||
opacityDuration = duration,
|
opacityDuration = duration,
|
||||||
opacityDelay = 0,
|
opacityDelay = 0,
|
||||||
|
manualDimensions,
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<WipeTransitionProps>) {
|
}: React.PropsWithChildren<WipeTransitionProps>) {
|
||||||
const [childRef, {
|
const [childRef, {
|
||||||
@@ -53,8 +58,8 @@ export function WipeTransition({
|
|||||||
opacity,
|
opacity,
|
||||||
clipPath: wipe.to(wipeProgress => {
|
clipPath: wipe.to(wipeProgress => {
|
||||||
const coordinates = wipeCustomDegClip(
|
const coordinates = wipeCustomDegClip(
|
||||||
childWidth,
|
(manualDimensions?.width ?? 0) || childWidth,
|
||||||
childHeight,
|
(manualDimensions?.height ?? 0) || childHeight,
|
||||||
wipeProgress,
|
wipeProgress,
|
||||||
startingCorner,
|
startingCorner,
|
||||||
angle,
|
angle,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useSelector } from "react-redux";
|
|||||||
|
|
||||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||||
import { CarStatus } from "../../../../types/state";
|
import { BGTimingTowerDisplayMode, CarStatus } from "../../../../types/state";
|
||||||
import { Fraction } from "../../../../types/style";
|
import { Fraction } from "../../../../types/style";
|
||||||
|
|
||||||
import { RowsContainer } from "./styles";
|
import { RowsContainer } from "./styles";
|
||||||
@@ -48,12 +48,17 @@ export function TimingTower({ debugDurationMultiplier: DDM }: TimingTowerProps)
|
|||||||
trackLength={trackLength}
|
trackLength={trackLength}
|
||||||
debugDurationMultiplier={DDM}
|
debugDurationMultiplier={DDM}
|
||||||
/>));
|
/>));
|
||||||
}, [lastUpdate, splitsMode]);
|
}, [lastUpdate, splitsMode, displayMode]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RowsContainer
|
<RowsContainer
|
||||||
carsToDisplay={startingCarsCount}
|
carsToDisplay={startingCarsCount}
|
||||||
retiredCarsPresent={retiredCarsCount > 0}
|
retiredCarsPresent={retiredCarsCount > 0}
|
||||||
|
open={displayMode !== BGTimingTowerDisplayMode.Hidden}
|
||||||
|
transitionProps={[{
|
||||||
|
property: "opacity",
|
||||||
|
duration: 1000,
|
||||||
|
}]}
|
||||||
>
|
>
|
||||||
{rows}
|
{rows}
|
||||||
</RowsContainer>
|
</RowsContainer>
|
||||||
|
|||||||
@@ -34,12 +34,16 @@ import {
|
|||||||
TimeDiff,
|
TimeDiff,
|
||||||
RowLeftHalfPosFlagChangeContainer,
|
RowLeftHalfPosFlagChangeContainer,
|
||||||
AnimatedRowLeftHalfOutline,
|
AnimatedRowLeftHalfOutline,
|
||||||
|
DriverNameContainer,
|
||||||
|
DriverNameWipe,
|
||||||
} from "./styles";
|
} from "./styles";
|
||||||
import useMeasure from "react-use-measure";
|
import useMeasure from "react-use-measure";
|
||||||
|
|
||||||
const WIPE_DELAY: Milliseconds = 3500;
|
const WIPE_DELAY: Milliseconds = 3500;
|
||||||
const WIPE_DURATION: Milliseconds = 400;
|
const WIPE_DURATION: Milliseconds = 400;
|
||||||
const TRAVEL_DURATION: Milliseconds = 750;
|
const TRAVEL_DURATION: Milliseconds = 750;
|
||||||
|
const FULL_WIDTH_DURATION: Milliseconds = 750;
|
||||||
|
const FULL_WIDTH_CLOSE_DELAY: Milliseconds = 333;
|
||||||
|
|
||||||
interface TimingTowerRowProps {
|
interface TimingTowerRowProps {
|
||||||
car: Car;
|
car: Car;
|
||||||
@@ -63,13 +67,15 @@ export function TimingTowerRow({
|
|||||||
}: TimingTowerRowProps) {
|
}: TimingTowerRowProps) {
|
||||||
const [pastPos, setPastPos] = useState(car.position);
|
const [pastPos, setPastPos] = useState(car.position);
|
||||||
const [posChange, setPosChange] = useState(0);
|
const [posChange, setPosChange] = useState(0);
|
||||||
|
const [pastDisplayMode, setPastDisplayMode] = useState(displayMode);
|
||||||
|
const [hugRight, setHugRight] = useState(true);
|
||||||
|
|
||||||
// Using timeouts and boolean states I can manipulate visiblity of the position
|
// Using timeouts and boolean states I can manipulate visiblity of the position
|
||||||
// change effects. wipeVisible is true for only 1ms before being switched back off.
|
// change effects. wipeVisible is true for only 1ms before being switched back off.
|
||||||
const [showPosChange, setshowPosChange] = useState(false);
|
const [showPosChange, setShowPosChange] = useState(false);
|
||||||
const [showOutline, setShowOutline] = useState(false);
|
const [showOutline, setShowOutline] = useState(false);
|
||||||
const [wipeVisible, setWipeVisible] = useState(false);
|
const [wipeVisible, setWipeVisible] = useState(false);
|
||||||
useTimeoutWhen(() => setshowPosChange(false), (WIPE_DELAY + WIPE_DURATION) * DDM, showPosChange);
|
useTimeoutWhen(() => setShowPosChange(false), (WIPE_DELAY + WIPE_DURATION) * DDM, showPosChange);
|
||||||
useTimeoutWhen(() => setShowOutline(false), TRAVEL_DURATION * DDM, showOutline);
|
useTimeoutWhen(() => setShowOutline(false), TRAVEL_DURATION * DDM, showOutline);
|
||||||
useTimeoutWhen(() => setWipeVisible(false), 1, wipeVisible);
|
useTimeoutWhen(() => setWipeVisible(false), 1, wipeVisible);
|
||||||
|
|
||||||
@@ -77,12 +83,28 @@ export function TimingTowerRow({
|
|||||||
if (car.position !== pastPos) {
|
if (car.position !== pastPos) {
|
||||||
setPastPos(car.position);
|
setPastPos(car.position);
|
||||||
setPosChange(pastPos - car.position);
|
setPosChange(pastPos - car.position);
|
||||||
setshowPosChange(true);
|
setShowPosChange(true);
|
||||||
setShowOutline(true);
|
setShowOutline(true);
|
||||||
setWipeVisible(true);
|
setWipeVisible(true);
|
||||||
}
|
}
|
||||||
}, [car.position]);
|
}, [car.position]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (pastDisplayMode !== displayMode) {
|
||||||
|
if ((pastDisplayMode === BGTimingTowerDisplayMode.LeftAndRight
|
||||||
|
&& displayMode === BGTimingTowerDisplayMode.FullLeft) || (
|
||||||
|
pastDisplayMode === BGTimingTowerDisplayMode.FullLeft
|
||||||
|
&& displayMode === BGTimingTowerDisplayMode.LeftAndRight
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
setHugRight(true);
|
||||||
|
} else {
|
||||||
|
setHugRight(false);
|
||||||
|
}
|
||||||
|
setPastDisplayMode(displayMode);
|
||||||
|
}
|
||||||
|
}, [displayMode]);
|
||||||
|
|
||||||
const { outlineClipPathProgress } = useSpring({
|
const { outlineClipPathProgress } = useSpring({
|
||||||
outlineClipPathProgress: showPosChange ? 1 : 0,
|
outlineClipPathProgress: showPosChange ? 1 : 0,
|
||||||
config: { duration: 333 * DDM },
|
config: { duration: 333 * DDM },
|
||||||
@@ -127,38 +149,67 @@ export function TimingTowerRow({
|
|||||||
yScale = rightHalfContent.includes("+") ? 1.1 : 1.0;
|
yScale = rightHalfContent.includes("+") ? 1.1 : 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { design: { timingTower: timingTowerTheme } } = theme;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatedRowContainer
|
<AnimatedRowContainer
|
||||||
key={car.driver.id}
|
key={car.driver.id}
|
||||||
retired={car.status === CarStatus.Retired}
|
retired={car.status === CarStatus.Retired}
|
||||||
wide={displayMode !== BGTimingTowerDisplayMode.LeftOnly}
|
wide={displayMode !== BGTimingTowerDisplayMode.LeftOnly}
|
||||||
top={(car.position - 1) * theme.design.timingTower.rowHeightPx}
|
top={(car.position - 1) * timingTowerTheme.rowHeightPx}
|
||||||
transitionTime={TRAVEL_DURATION * DDM}
|
transitionTime={TRAVEL_DURATION * DDM}
|
||||||
>
|
>
|
||||||
{car.notices.includes(CarNotice.FastestLap) && (
|
{car.notices.includes(CarNotice.FastestLap) && (
|
||||||
<FastestLapGem />
|
<FastestLapGem />
|
||||||
)}
|
)}
|
||||||
<RowLeftHalf
|
<RowLeftHalf
|
||||||
|
roundedCornerTop={
|
||||||
|
(displayMode === BGTimingTowerDisplayMode.FullLeft &&
|
||||||
|
car.position === 1) ? 5 : 0
|
||||||
|
}
|
||||||
roundedCornerBottom={
|
roundedCornerBottom={
|
||||||
bottomRounded && orMatch(
|
bottomRounded && orMatch(
|
||||||
displayMode,
|
displayMode,
|
||||||
BGTimingTowerDisplayMode.LeftOnly,
|
BGTimingTowerDisplayMode.LeftOnly,
|
||||||
BGTimingTowerDisplayMode.FullLeft,
|
BGTimingTowerDisplayMode.FullLeft,
|
||||||
) ? 5 : undefined
|
) ? 5 : 0
|
||||||
}
|
}
|
||||||
transitionTime={TRAVEL_DURATION * DDM}
|
open={displayMode === BGTimingTowerDisplayMode.FullLeft}
|
||||||
|
transitionOpeningProps={[{
|
||||||
|
property: "width",
|
||||||
|
duration: FULL_WIDTH_DURATION * DDM,
|
||||||
|
}, {
|
||||||
|
property: "border-top-right-radius",
|
||||||
|
duration: TRAVEL_DURATION * DDM,
|
||||||
|
}, {
|
||||||
|
property: "border-bottom-right-radius",
|
||||||
|
duration: TRAVEL_DURATION * DDM,
|
||||||
|
}]}
|
||||||
|
transitionClosingProps={[{
|
||||||
|
property: "width",
|
||||||
|
duration: FULL_WIDTH_DURATION * DDM,
|
||||||
|
delay: FULL_WIDTH_CLOSE_DELAY * DDM,
|
||||||
|
}, {
|
||||||
|
property: "border-top-right-radius",
|
||||||
|
duration: TRAVEL_DURATION * DDM,
|
||||||
|
delay: FULL_WIDTH_CLOSE_DELAY * DDM,
|
||||||
|
}, {
|
||||||
|
property: "border-bottom-right-radius",
|
||||||
|
duration: TRAVEL_DURATION * DDM,
|
||||||
|
delay: FULL_WIDTH_CLOSE_DELAY * DDM,
|
||||||
|
}]}
|
||||||
ref={leftHalfRef}
|
ref={leftHalfRef}
|
||||||
>
|
>
|
||||||
<RowLeftHalfLayout>
|
<RowLeftHalfLayout>
|
||||||
{car.status !== CarStatus.Retired && (
|
{car.status !== CarStatus.Retired && (
|
||||||
<RowLeftHalfPosFlagContainer size={32}>
|
<RowLeftHalfPosFlagContainer size={timingTowerTheme.posFlagSize}>
|
||||||
<PositionFlag
|
<PositionFlag
|
||||||
size={32}
|
size={timingTowerTheme.posFlagSize}
|
||||||
number={car.position}
|
number={car.position}
|
||||||
numberSizeFraction={.6}
|
numberSizeFraction={.6}
|
||||||
/>
|
/>
|
||||||
<RowLeftHalfPosFlagChangeContainer
|
<RowLeftHalfPosFlagChangeContainer
|
||||||
size={32}
|
size={timingTowerTheme.posFlagSize}
|
||||||
visible={showPosChange}
|
visible={showPosChange}
|
||||||
transitionTime={167 * DDM}
|
transitionTime={167 * DDM}
|
||||||
>
|
>
|
||||||
@@ -171,7 +222,7 @@ export function TimingTowerRow({
|
|||||||
startingCorner="topLeft"
|
startingCorner="topLeft"
|
||||||
>
|
>
|
||||||
<PositionFlag
|
<PositionFlag
|
||||||
size={32}
|
size={timingTowerTheme.posFlagSize}
|
||||||
number={car.position}
|
number={car.position}
|
||||||
numberSizeFraction={.6}
|
numberSizeFraction={.6}
|
||||||
color={posChange > 0
|
color={posChange > 0
|
||||||
@@ -182,15 +233,53 @@ export function TimingTowerRow({
|
|||||||
|
|
||||||
)}
|
)}
|
||||||
</RowLeftHalfPosFlagChangeContainer>
|
</RowLeftHalfPosFlagChangeContainer>
|
||||||
|
|
||||||
</RowLeftHalfPosFlagContainer>
|
</RowLeftHalfPosFlagContainer>
|
||||||
)}
|
)}
|
||||||
<DriverName>
|
<DriverNameContainer>
|
||||||
{car.driver.initials}
|
<DriverName
|
||||||
</DriverName>
|
open={displayMode !== BGTimingTowerDisplayMode.FullLeft}
|
||||||
|
transitionOpeningProps={[{
|
||||||
|
property: "opacity",
|
||||||
|
duration: 333 * DDM,
|
||||||
|
delay: (FULL_WIDTH_DURATION - 333) * DDM,
|
||||||
|
}]}
|
||||||
|
transitionClosingProps={[{
|
||||||
|
property: "opacity",
|
||||||
|
duration: 333 * DDM,
|
||||||
|
delay: 0 * DDM,
|
||||||
|
}]}
|
||||||
|
>
|
||||||
|
{car.driver.initials}
|
||||||
|
</DriverName>
|
||||||
|
<DriverNameWipe
|
||||||
|
open={displayMode === BGTimingTowerDisplayMode.FullLeft}
|
||||||
|
transitionOpeningProps={[{
|
||||||
|
property: "width",
|
||||||
|
duration: FULL_WIDTH_DURATION * 2 * DDM,
|
||||||
|
delay: 0 * DDM,
|
||||||
|
}, {
|
||||||
|
property: "opacity",
|
||||||
|
duration: 333 * DDM,
|
||||||
|
delay: 0 * DDM,
|
||||||
|
}]}
|
||||||
|
transitionClosingProps={[{
|
||||||
|
property: "width",
|
||||||
|
duration: FULL_WIDTH_DURATION * DDM,
|
||||||
|
delay: 0 * DDM,
|
||||||
|
}, {
|
||||||
|
property: "opacity",
|
||||||
|
duration: 333 * DDM,
|
||||||
|
delay: (FULL_WIDTH_DURATION - 333) * DDM,
|
||||||
|
}]}
|
||||||
|
>
|
||||||
|
<DriverName open>
|
||||||
|
{car.driver.lastName}
|
||||||
|
</DriverName>
|
||||||
|
</DriverNameWipe>
|
||||||
|
</DriverNameContainer>
|
||||||
</RowLeftHalfLayout>
|
</RowLeftHalfLayout>
|
||||||
<RowLeftHalfGemContainer>
|
<RowLeftHalfGemContainer>
|
||||||
<TeamGem team={car.driver.team.id} height={30} />
|
<TeamGem team={car.driver.team.id} height={timingTowerTheme.teamGemSize} />
|
||||||
</RowLeftHalfGemContainer>
|
</RowLeftHalfGemContainer>
|
||||||
|
|
||||||
<AnimatedRowLeftHalfOutline
|
<AnimatedRowLeftHalfOutline
|
||||||
@@ -223,18 +312,48 @@ export function TimingTowerRow({
|
|||||||
</RowLeftHalf>
|
</RowLeftHalf>
|
||||||
|
|
||||||
<RowRightHalf
|
<RowRightHalf
|
||||||
roundedCornerTop={car.position === 1 ? 5 : undefined}
|
roundedCornerTop={car.position === 1 ? 5 : 0}
|
||||||
roundedCornerBottom={
|
roundedCornerBottom={
|
||||||
bottomRounded && orMatch(
|
bottomRounded && orMatch(
|
||||||
splitsMode,
|
splitsMode,
|
||||||
BGTimingTowerSplitsMode.Leader,
|
BGTimingTowerSplitsMode.Leader,
|
||||||
BGTimingTowerSplitsMode.Interval,
|
BGTimingTowerSplitsMode.Interval,
|
||||||
) ? 5 : undefined
|
) ? 5 : 0
|
||||||
}
|
}
|
||||||
transitionTime={TRAVEL_DURATION * DDM}
|
open={displayMode === BGTimingTowerDisplayMode.LeftAndRight}
|
||||||
|
transitionProps={[{
|
||||||
|
property: "border-top-right-radius",
|
||||||
|
duration: TRAVEL_DURATION * DDM,
|
||||||
|
}, {
|
||||||
|
property: "border-bottom-right-radius",
|
||||||
|
duration: TRAVEL_DURATION * DDM,
|
||||||
|
}]}
|
||||||
|
transitionClosingProps={[{
|
||||||
|
property: "width",
|
||||||
|
duration: FULL_WIDTH_DURATION * DDM,
|
||||||
|
}]}
|
||||||
|
transitionOpeningProps={[{
|
||||||
|
property: "width",
|
||||||
|
duration: FULL_WIDTH_DURATION * DDM,
|
||||||
|
delay: FULL_WIDTH_CLOSE_DELAY * DDM,
|
||||||
|
}]}
|
||||||
|
hugRight={hugRight}
|
||||||
>
|
>
|
||||||
<RowRightHalfLayout>
|
<RowRightHalfLayout>
|
||||||
<TimeDiff xScale={xScale} yScale={yScale}>
|
<TimeDiff
|
||||||
|
xScale={xScale}
|
||||||
|
yScale={yScale}
|
||||||
|
open={displayMode === BGTimingTowerDisplayMode.LeftAndRight}
|
||||||
|
transitionOpeningProps={[{
|
||||||
|
property: "opacity",
|
||||||
|
duration: FULL_WIDTH_DURATION * DDM,
|
||||||
|
delay: FULL_WIDTH_CLOSE_DELAY * DDM,
|
||||||
|
}]}
|
||||||
|
transitionClosingProps={[{
|
||||||
|
property: "opacity",
|
||||||
|
duration: FULL_WIDTH_DURATION * DDM,
|
||||||
|
}]}
|
||||||
|
>
|
||||||
{rightHalfContent}
|
{rightHalfContent}
|
||||||
</TimeDiff>
|
</TimeDiff>
|
||||||
</RowRightHalfLayout>
|
</RowRightHalfLayout>
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
import { animated } from "@react-spring/web";
|
import { animated } from "@react-spring/web";
|
||||||
|
|
||||||
import { Fraction, Px, TransitionArgs } from "../../../../types/style";
|
import {
|
||||||
|
Fraction,
|
||||||
|
Px,
|
||||||
|
DirectionalTransitionProps,
|
||||||
|
} from "../../../../types/style";
|
||||||
import { Milliseconds } from "../../../../types/util";
|
import { Milliseconds } from "../../../../types/util";
|
||||||
import { commonTransition } from "../../../../utils/styling";
|
import { commonDirectionalTransition } from "../../../../utils/styling";
|
||||||
|
|
||||||
import fastestLapIcon from "../../../../public/images/icons/fastest-lap.svg";
|
import fastestLapIcon from "../../../../public/images/icons/fastest-lap.svg";
|
||||||
|
|
||||||
|
|
||||||
type OpenProps = {
|
type RowsContainerProps = DirectionalTransitionProps & {
|
||||||
open: boolean,
|
|
||||||
};
|
|
||||||
type TransitionProps = OpenProps & {
|
|
||||||
transitionProps: TransitionArgs[],
|
|
||||||
};
|
|
||||||
|
|
||||||
type RowsContainerProps = {
|
|
||||||
carsToDisplay: number,
|
carsToDisplay: number,
|
||||||
retiredCarsPresent: boolean,
|
retiredCarsPresent: boolean,
|
||||||
};
|
};
|
||||||
@@ -29,6 +26,10 @@ export const RowsContainer = styled.div<RowsContainerProps>`
|
|||||||
theme.design.timingTower.rowHeightPx * carsToDisplay + (retiredCarsPresent ? 3 : 0)}px;
|
theme.design.timingTower.rowHeightPx * carsToDisplay + (retiredCarsPresent ? 3 : 0)}px;
|
||||||
|
|
||||||
overflow-y: clip; // hidden doesn't work for some reason.
|
overflow-y: clip; // hidden doesn't work for some reason.
|
||||||
|
|
||||||
|
opacity: ${({ open }) => open ? 1 : 0};
|
||||||
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||||
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||||
`;
|
`;
|
||||||
RowsContainer.displayName = "RowsContainer";
|
RowsContainer.displayName = "RowsContainer";
|
||||||
|
|
||||||
@@ -61,36 +62,37 @@ AnimatedRowContainer.displayName = "AnimatedRowContainer";
|
|||||||
type RoundedProp = {
|
type RoundedProp = {
|
||||||
roundedCornerTop?: Px,
|
roundedCornerTop?: Px,
|
||||||
roundedCornerBottom?: Px,
|
roundedCornerBottom?: Px,
|
||||||
transitionTime: Milliseconds,
|
|
||||||
};
|
};
|
||||||
const Rounded = styled.div<RoundedProp>`
|
const Rounded = styled.div<RoundedProp>`
|
||||||
${({ roundedCornerTop }) =>
|
border-top-right-radius: ${({ roundedCornerTop = 0 }) => roundedCornerTop}px;
|
||||||
roundedCornerTop && css`border-top-right-radius: ${roundedCornerTop}px;`}
|
border-bottom-right-radius: ${({ roundedCornerBottom = 0 }) => roundedCornerBottom}px;
|
||||||
${({ roundedCornerBottom }) =>
|
|
||||||
roundedCornerBottom && css`border-bottom-right-radius: ${roundedCornerBottom}px;`}
|
|
||||||
transition: border-top-right-radius ${({ transitionTime }) => transitionTime}ms,
|
|
||||||
border-bottom-right-radius ${({ transitionTime }) => transitionTime}ms;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const RowLeftHalf = styled(Rounded)`
|
export const RowLeftHalf = styled(Rounded)<DirectionalTransitionProps>`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
overflow-x: clip;
|
||||||
|
|
||||||
width: ${p => p.theme.design.timingTower.rowLeftHalfWidthPx}px; // Future will be animated.
|
width: ${({ theme: { design: { timingTower } }, open }) =>
|
||||||
|
(open ? timingTower.rowRightHalfWidthPx : 0) + timingTower.rowLeftHalfWidthPx}px;
|
||||||
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
||||||
|
|
||||||
background-color: #000000e5
|
background-color: #000000e5;
|
||||||
|
|
||||||
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||||
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||||
`;
|
`;
|
||||||
RowLeftHalf.displayName = "RowLeftHalf";
|
RowLeftHalf.displayName = "RowLeftHalf";
|
||||||
|
|
||||||
type AnimatedRowLeftHalfOutlineProps = TransitionProps & {
|
type AnimatedRowLeftHalfOutlineProps = DirectionalTransitionProps & {
|
||||||
startThickness: Px,
|
startThickness: Px,
|
||||||
endThickness: Px,
|
endThickness: Px,
|
||||||
startColor: string,
|
startColor: string,
|
||||||
endColor: string,
|
endColor: string,
|
||||||
};
|
};
|
||||||
export const AnimatedRowLeftHalfOutline = animated(styled(Rounded) <AnimatedRowLeftHalfOutlineProps>`
|
export const AnimatedRowLeftHalfOutline = animated(styled(Rounded)<AnimatedRowLeftHalfOutlineProps>`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -103,7 +105,8 @@ export const AnimatedRowLeftHalfOutline = animated(styled(Rounded) <AnimatedRowL
|
|||||||
: `${startThickness}px solid ${startColor}`};
|
: `${startThickness}px solid ${startColor}`};
|
||||||
outline-offset: ${({ startThickness }) => -startThickness}px;
|
outline-offset: ${({ startThickness }) => -startThickness}px;
|
||||||
|
|
||||||
${({ transitionProps }) => commonTransition(transitionProps)}
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||||
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||||
`);
|
`);
|
||||||
AnimatedRowLeftHalfOutline.displayName = "AnimatedRowLeftHalfOutline";
|
AnimatedRowLeftHalfOutline.displayName = "AnimatedRowLeftHalfOutline";
|
||||||
|
|
||||||
@@ -115,7 +118,6 @@ export const RowLeftHalfLayout = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
`;
|
`;
|
||||||
RowLeftHalfLayout.displayName = "RowLeftHalfLayout";
|
RowLeftHalfLayout.displayName = "RowLeftHalfLayout";
|
||||||
@@ -155,17 +157,29 @@ export const RowLeftHalfGemContainer = styled.div`
|
|||||||
`;
|
`;
|
||||||
RowLeftHalfGemContainer.displayName = "RowLeftHalfGemContainer";
|
RowLeftHalfGemContainer.displayName = "RowLeftHalfGemContainer";
|
||||||
|
|
||||||
export const RowRightHalf = styled(Rounded)`
|
type RowRightHalfProps = DirectionalTransitionProps & {
|
||||||
|
hugRight: boolean,
|
||||||
|
};
|
||||||
|
export const RowRightHalf = styled(Rounded)<RowRightHalfProps>`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
${({ hugRight }) => hugRight
|
||||||
|
? css`
|
||||||
|
right: 0;
|
||||||
|
` : css`
|
||||||
|
left: ${p => p.theme.design.timingTower.rowLeftHalfWidthPx}px;
|
||||||
|
`}
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
||||||
width: ${p => p.theme.design.timingTower.rowRightHalfWidthPx}px; // Future will be animated.
|
width: ${({ theme: { design: { timingTower } }, open }) =>
|
||||||
|
open ? timingTower.rowRightHalfWidthPx : 0}px;
|
||||||
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
||||||
|
|
||||||
overflow-x: hidden;
|
overflow-x: clip;
|
||||||
|
|
||||||
background-color: #0000007e
|
background-color: #0000007e;
|
||||||
|
|
||||||
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||||
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||||
`;
|
`;
|
||||||
RowRightHalf.displayName = "RowRightHalf";
|
RowRightHalf.displayName = "RowRightHalf";
|
||||||
|
|
||||||
@@ -181,15 +195,44 @@ export const RowRightHalfLayout = styled.div`
|
|||||||
`;
|
`;
|
||||||
RowRightHalfLayout.displayName = "RowRightHalfLayout";
|
RowRightHalfLayout.displayName = "RowRightHalfLayout";
|
||||||
|
|
||||||
export const DriverName = styled.span`
|
export const DriverNameContainer = styled.div`
|
||||||
|
position: relative;
|
||||||
|
margin-left: ${p => p.theme.design.timingTower.nameLeftMargin}px;
|
||||||
|
`;
|
||||||
|
DriverNameContainer.displayName = "DriverNameContainer";
|
||||||
|
|
||||||
|
export const DriverName = styled.span<DirectionalTransitionProps>`
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
font-family: ${p => p.theme.fonts.f1Bold};
|
font-family: ${p => p.theme.fonts.f1Bold};
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
margin-left: 14px;
|
text-transform: uppercase;
|
||||||
|
|
||||||
|
opacity: ${({ open }) => open ? 1 : 0};
|
||||||
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||||
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||||
`;
|
`;
|
||||||
DriverName.displayName = "DriverName";
|
DriverName.displayName = "DriverName";
|
||||||
|
|
||||||
type TimeDiffProps = {
|
export const DriverNameWipe = styled.div<DirectionalTransitionProps>`
|
||||||
|
/* background: #deadbe; */
|
||||||
|
|
||||||
|
width: ${({ open }) => open ? 800 : 200}px;
|
||||||
|
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
||||||
|
|
||||||
|
mask-image: linear-gradient(to right, black 0, black 20%, transparent 30%);
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
|
||||||
|
opacity: ${({ open }) => open ? 1 : 0};
|
||||||
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||||
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||||
|
`;
|
||||||
|
DriverNameWipe.displayName = "DriverNameWipe";
|
||||||
|
|
||||||
|
type TimeDiffProps = DirectionalTransitionProps & {
|
||||||
xScale: Fraction,
|
xScale: Fraction,
|
||||||
yScale: Fraction,
|
yScale: Fraction,
|
||||||
};
|
};
|
||||||
@@ -203,6 +246,10 @@ export const TimeDiff = styled.span<TimeDiffProps>`
|
|||||||
font-feature-settings: 'tnum' 1;
|
font-feature-settings: 'tnum' 1;
|
||||||
transform-origin: top right;
|
transform-origin: top right;
|
||||||
transform: scale(${({ xScale, yScale }) => `${xScale}, ${yScale}`});
|
transform: scale(${({ xScale, yScale }) => `${xScale}, ${yScale}`});
|
||||||
|
|
||||||
|
opacity: ${({ open }) => open ? 1 : 0};
|
||||||
|
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||||
|
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||||
`;
|
`;
|
||||||
TimeDiff.displayName = "TimeDiff";
|
TimeDiff.displayName = "TimeDiff";
|
||||||
|
|
||||||
|
|||||||
+90
-67
@@ -1,14 +1,15 @@
|
|||||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||||
import { PadBox } from "@bedrock-layout/padbox";
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
import { Split } from "@bedrock-layout/split";
|
import { Split } from "@bedrock-layout/split";
|
||||||
|
import { Stack } from "@bedrock-layout/stack";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { broadcastDirectorSelector } from "../../../../features/broadcast/director/broadcastDirectorSelector";
|
import { broadcastDirectorSelector } from "../../../../features/broadcast/director/broadcastDirectorSelector";
|
||||||
|
|
||||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||||
import { setTimingTowerSplitsMode } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
import { setTimingTowerDisplayMode, setTimingTowerSplitsMode } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
||||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||||
import { increaseDistance, refreshRunningOrder, setCarStatus } from "../../../../features/event/eventSlice";
|
import { increaseDistance, refreshRunningOrder, setCarStatus } from "../../../../features/event/eventSlice";
|
||||||
import { BGTimingTowerSplitsMode, CarStatus } from "../../../../types/state";
|
import { BGTimingTowerDisplayMode, BGTimingTowerSplitsMode, CarStatus } from "../../../../types/state";
|
||||||
import { GridSelection } from "../GridSelection";
|
import { GridSelection } from "../GridSelection";
|
||||||
|
|
||||||
import { ClickSpan } from "./styles";
|
import { ClickSpan } from "./styles";
|
||||||
@@ -16,75 +17,97 @@ import { ClickSpan } from "./styles";
|
|||||||
export function TimingTowerPrototypeControls() {
|
export function TimingTowerPrototypeControls() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { selectedCars } = useSelector(broadcastDirectorSelector);
|
const { selectedCars } = useSelector(broadcastDirectorSelector);
|
||||||
const { timingBoard: { timingTower: { splitsMode } } } = useSelector(broadcastGraphicsSelector);
|
const { timingBoard: { timingTower: { splitsMode, displayMode } } } = useSelector(broadcastGraphicsSelector);
|
||||||
const { grid } = useSelector(eventSelector);
|
const { grid } = useSelector(eventSelector);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Split gutter="md">
|
<Split gutter="md">
|
||||||
<InlineCluster as={PadBox} padding="md" gutter="md">
|
<Stack gutter="md">
|
||||||
<ClickSpan onClick={() => dispatch(refreshRunningOrder())}>
|
|
||||||
Refresh Running Order
|
<PadBox padding="md">
|
||||||
</ClickSpan>
|
<InlineCluster gutter="md">
|
||||||
<ClickSpan
|
<ClickSpan onClick={() => dispatch(refreshRunningOrder())}>
|
||||||
onClick={() => {
|
Refresh Running Order
|
||||||
if (splitsMode === BGTimingTowerSplitsMode.Interval) {
|
</ClickSpan>
|
||||||
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Leader));
|
<ClickSpan
|
||||||
} else {
|
onClick={() => {
|
||||||
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Interval));
|
dispatch(increaseDistance({
|
||||||
}
|
cars: selectedCars,
|
||||||
}}
|
distance: 200,
|
||||||
>
|
randomness: 0,
|
||||||
Splits Mode = {BGTimingTowerSplitsMode[splitsMode]}
|
usePerformance: false,
|
||||||
</ClickSpan>
|
}));
|
||||||
<ClickSpan
|
dispatch(refreshRunningOrder());
|
||||||
onClick={() => {
|
}}
|
||||||
dispatch(increaseDistance({
|
>
|
||||||
cars: selectedCars,
|
+200m
|
||||||
distance: 200,
|
</ClickSpan>
|
||||||
randomness: 0,
|
<ClickSpan
|
||||||
usePerformance: false,
|
onClick={() => {
|
||||||
}));
|
dispatch(increaseDistance({
|
||||||
dispatch(refreshRunningOrder());
|
cars: grid,
|
||||||
}}
|
distance: 100,
|
||||||
>
|
randomness: 0.05,
|
||||||
+200m to cars
|
usePerformance: true,
|
||||||
</ClickSpan>
|
}));
|
||||||
<ClickSpan
|
dispatch(refreshRunningOrder());
|
||||||
onClick={() => {
|
}}
|
||||||
dispatch(increaseDistance({
|
>
|
||||||
cars: grid,
|
+100m performance to all
|
||||||
distance: 100,
|
</ClickSpan>
|
||||||
randomness: 0.05,
|
<ClickSpan
|
||||||
usePerformance: true,
|
onClick={() => {
|
||||||
}));
|
dispatch(setCarStatus({
|
||||||
dispatch(refreshRunningOrder());
|
cars: selectedCars,
|
||||||
}}
|
status: CarStatus.Retired,
|
||||||
>
|
}));
|
||||||
+100m performance to all
|
dispatch(refreshRunningOrder());
|
||||||
</ClickSpan>
|
}}
|
||||||
<ClickSpan
|
>
|
||||||
onClick={() => {
|
Retire
|
||||||
dispatch(setCarStatus({
|
</ClickSpan>
|
||||||
cars: selectedCars,
|
<ClickSpan
|
||||||
status: CarStatus.Retired,
|
onClick={() => {
|
||||||
}));
|
dispatch(setCarStatus({
|
||||||
dispatch(refreshRunningOrder());
|
cars: selectedCars,
|
||||||
}}
|
status: CarStatus.Normal,
|
||||||
>
|
}));
|
||||||
Retire cars
|
dispatch(refreshRunningOrder());
|
||||||
</ClickSpan>
|
}}
|
||||||
<ClickSpan
|
>
|
||||||
onClick={() => {
|
Un-retire
|
||||||
dispatch(setCarStatus({
|
</ClickSpan>
|
||||||
cars: selectedCars,
|
</InlineCluster>
|
||||||
status: CarStatus.Normal,
|
<hr />
|
||||||
}));
|
<InlineCluster gutter="md">
|
||||||
dispatch(refreshRunningOrder());
|
<ClickSpan
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
if (splitsMode === BGTimingTowerSplitsMode.Interval) {
|
||||||
Un-retire cars
|
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Leader));
|
||||||
</ClickSpan>
|
} else {
|
||||||
</InlineCluster>
|
dispatch(setTimingTowerSplitsMode(BGTimingTowerSplitsMode.Interval));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Splits Mode = {BGTimingTowerSplitsMode[splitsMode]}
|
||||||
|
</ClickSpan>
|
||||||
|
<ClickSpan onClick={() => dispatch(setTimingTowerDisplayMode(BGTimingTowerDisplayMode.LeftAndRight))}>
|
||||||
|
{(displayMode === BGTimingTowerDisplayMode.LeftAndRight ? "*" : "") + "LeftAndRight"}
|
||||||
|
</ClickSpan>
|
||||||
|
<ClickSpan onClick={() => dispatch(setTimingTowerDisplayMode(BGTimingTowerDisplayMode.LeftOnly))}>
|
||||||
|
{(displayMode === BGTimingTowerDisplayMode.LeftOnly ? "*" : "") + "LeftOnly"}
|
||||||
|
</ClickSpan>
|
||||||
|
<ClickSpan onClick={() => dispatch(setTimingTowerDisplayMode(BGTimingTowerDisplayMode.FullLeft))}>
|
||||||
|
{(displayMode === BGTimingTowerDisplayMode.FullLeft ? "*" : "") + "FullLeft"}
|
||||||
|
</ClickSpan>
|
||||||
|
<ClickSpan onClick={() => dispatch(setTimingTowerDisplayMode(BGTimingTowerDisplayMode.Hidden))}>
|
||||||
|
{(displayMode === BGTimingTowerDisplayMode.Hidden ? "*" : "") + "Hidden"}
|
||||||
|
</ClickSpan>
|
||||||
|
|
||||||
|
</InlineCluster>
|
||||||
|
</PadBox>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<PadBox padding="md">
|
<PadBox padding="md">
|
||||||
<GridSelection />
|
<GridSelection />
|
||||||
</PadBox>
|
</PadBox>
|
||||||
|
|||||||
@@ -220,7 +220,8 @@ export const drivers: {[lastName: string]: Driver} = {
|
|||||||
perez: {
|
perez: {
|
||||||
id: "perez",
|
id: "perez",
|
||||||
firstName: "Sergio",
|
firstName: "Sergio",
|
||||||
lastName: "Pérez",
|
// lastName: "Pérez",
|
||||||
|
lastName: "Perez",
|
||||||
number: 11,
|
number: 11,
|
||||||
team: teams.redBull,
|
team: teams.redBull,
|
||||||
yellowTCam: true,
|
yellowTCam: true,
|
||||||
@@ -231,7 +232,8 @@ export const drivers: {[lastName: string]: Driver} = {
|
|||||||
raikkonen: {
|
raikkonen: {
|
||||||
id: "raikkonen",
|
id: "raikkonen",
|
||||||
firstName: "Kimi",
|
firstName: "Kimi",
|
||||||
lastName: "Räikkönen",
|
// lastName: "Räikkönen",
|
||||||
|
lastName: "Raikkonen",
|
||||||
number: 7,
|
number: 7,
|
||||||
team: teams.alfaRomeo,
|
team: teams.alfaRomeo,
|
||||||
yellowTCam: false,
|
yellowTCam: false,
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ export const broadcastGraphicsSlice = createSlice({
|
|||||||
setTimingTowerSplitsMode: (state, action: PayloadAction<BGTimingTowerSplitsMode>) => {
|
setTimingTowerSplitsMode: (state, action: PayloadAction<BGTimingTowerSplitsMode>) => {
|
||||||
state.timingBoard.timingTower.splitsMode = action.payload;
|
state.timingBoard.timingTower.splitsMode = action.payload;
|
||||||
},
|
},
|
||||||
|
setTimingTowerDisplayMode: (state, action: PayloadAction<BGTimingTowerDisplayMode>) => {
|
||||||
|
state.timingBoard.timingTower.displayMode = action.payload;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -68,5 +71,6 @@ export const {
|
|||||||
incrementChyronsOpenState,
|
incrementChyronsOpenState,
|
||||||
clearChyrons,
|
clearChyrons,
|
||||||
setTimingTowerSplitsMode,
|
setTimingTowerSplitsMode,
|
||||||
|
setTimingTowerDisplayMode,
|
||||||
} = broadcastGraphicsSlice.actions;
|
} = broadcastGraphicsSlice.actions;
|
||||||
export default broadcastGraphicsSlice.reducer;
|
export default broadcastGraphicsSlice.reducer;
|
||||||
@@ -72,6 +72,9 @@ export const theme = {
|
|||||||
rowLeftHalfWidthPx: 147,
|
rowLeftHalfWidthPx: 147,
|
||||||
rowRightHalfWidthPx: 108,
|
rowRightHalfWidthPx: 108,
|
||||||
retiredTopGapPx: 3,
|
retiredTopGapPx: 3,
|
||||||
|
teamGemSize: 30,
|
||||||
|
posFlagSize: 32,
|
||||||
|
nameLeftMargin: 14,
|
||||||
},
|
},
|
||||||
button: {
|
button: {
|
||||||
borderRadius: "0.25rem",
|
borderRadius: "0.25rem",
|
||||||
|
|||||||
Vendored
+11
@@ -40,3 +40,14 @@ export interface TransitionArgs {
|
|||||||
timing?: string
|
timing?: string
|
||||||
delay?: Milliseconds,
|
delay?: Milliseconds,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type OpenProps = {
|
||||||
|
open: boolean,
|
||||||
|
};
|
||||||
|
export type TransitionProps = OpenProps & {
|
||||||
|
transitionProps?: TransitionArgs[],
|
||||||
|
};
|
||||||
|
export type DirectionalTransitionProps = TransitionProps & {
|
||||||
|
transitionOpeningProps?: TransitionArgs[],
|
||||||
|
transitionClosingProps?: TransitionArgs[],
|
||||||
|
}
|
||||||
+36
-3
@@ -62,16 +62,49 @@ export function wipeCustomDegClip(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function commonTransition(propsArray: TransitionArgs[]) {
|
/**
|
||||||
|
* Takes in an array of transition properties, durations, delays, and timings
|
||||||
|
* in a special interface and returns them into a format understood by CSS.
|
||||||
|
* Includes a semi-colon as well.
|
||||||
|
* @param propsArray
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function commonTransition(propsArray: TransitionArgs[] = []) {
|
||||||
|
if (propsArray.length === 0){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
"transition: "
|
"transition: "
|
||||||
+ propsArray.map(p => `
|
+ propsArray.map(p => `
|
||||||
${p?.property ?? "all"} ${p?.duration ?? 1000}ms ${p?.timing ?? ""} ${p?.delay ?? 0}ms
|
${p?.property ?? "all"} ${p?.duration ?? 1000}ms ${p?.timing ?? ""} ${p?.delay ?? 0}ms`,
|
||||||
`).join(", ")
|
).join(", ")
|
||||||
+ ";"
|
+ ";"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An extension and evolution of commonTransition() provides a way to define
|
||||||
|
* transition configurations that can be differentiated by which direction
|
||||||
|
* (opening or closing) that they're going and can even support additional
|
||||||
|
* "shared" properties that are common in either direction.
|
||||||
|
* @param open the (often visible) state of the element
|
||||||
|
* @param openingPropsArray what transition props to use when "open" (opening)
|
||||||
|
* @param closingPropsArray what transition props to use when "closed" (closing)
|
||||||
|
* @param sharedPropsArray what transition props to use in either direction
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function commonDirectionalTransition(
|
||||||
|
open: boolean,
|
||||||
|
openingPropsArray: TransitionArgs[] = [],
|
||||||
|
closingPropsArray: TransitionArgs[] = [],
|
||||||
|
sharedPropsArray: TransitionArgs[] = [],
|
||||||
|
) {
|
||||||
|
return open
|
||||||
|
? commonTransition(openingPropsArray.concat(sharedPropsArray))
|
||||||
|
: commonTransition(closingPropsArray.concat(sharedPropsArray));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the x, y coordinates of a six point polygon for use in a clip-path
|
* 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
|
* mask. By taking a fraction to indicate the progress through the animation it
|
||||||
|
|||||||
Reference in new issue
Block a user