ISSUE-062 - Lap indicator now looking good and animating well.
New scheduled lap event state. New alternative white color that matches what's seen in reality. New overlay for wide lap indicator.
This commit is contained in:
1 parent
d2e4afb975
commit
1af134b9a4
9 files changed
+178
-16
No files matched your search
@@ -1,14 +1,18 @@
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import { BGStatusIndicatorModes } from "../../../../types/state";
|
||||
import { DebugDurationProps } from "../../../../types/style";
|
||||
import { DebugDurationProps, TransitionArgs } from "../../../../types/style";
|
||||
import { orMatch } from "../../../../utils/common";
|
||||
|
||||
import { StatusIndicatorBase } from "./styles";
|
||||
import { LapCount, LapLabel, LapLine, StatusIndicatorBase, StatusIndicatorLayout } from "./styles";
|
||||
|
||||
type StatusIndicatorProps = DebugDurationProps;
|
||||
|
||||
|
||||
|
||||
export function StatusIndicator({
|
||||
debugDurationMultiplier: DDM = 1.0,
|
||||
}: StatusIndicatorProps) {
|
||||
@@ -16,19 +20,56 @@ export function StatusIndicator({
|
||||
|
||||
const { timingBoard: { statusIndicator: { mode } } } =
|
||||
useSelector(broadcastGraphicsSelector);
|
||||
const { progress: { scheduledLaps, lapCount } } = useSelector(eventSelector);
|
||||
|
||||
const toWideTransition: TransitionArgs[] = [{
|
||||
property: "all",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
}];
|
||||
const toNarrowTransition: TransitionArgs[] = [{
|
||||
property: "all",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
delay: ttTheme.fullWidthCloseDelayMs * DDM,
|
||||
}];
|
||||
|
||||
return (
|
||||
<StatusIndicatorBase
|
||||
open={mode !== BGStatusIndicatorModes.LapNarrow}
|
||||
transitionOpeningProps={[{
|
||||
property: "width",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
}]}
|
||||
transitionClosingProps={[{
|
||||
property: "width",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
delay: ttTheme.fullWidthCloseDelayMs * DDM,
|
||||
}]}
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
>
|
||||
<StatusIndicatorLayout>
|
||||
{orMatch(mode, BGStatusIndicatorModes.LapNarrow, BGStatusIndicatorModes.LapWide) && (
|
||||
<>
|
||||
<LapLine
|
||||
mode={BGStatusIndicatorModes.LapNarrow}
|
||||
open={mode === BGStatusIndicatorModes.LapNarrow}
|
||||
transitionOpeningProps={toNarrowTransition}
|
||||
transitionClosingProps={toWideTransition}
|
||||
/>
|
||||
<LapLine
|
||||
mode={BGStatusIndicatorModes.LapWide}
|
||||
open={mode === BGStatusIndicatorModes.LapWide}
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
/>
|
||||
<LapLabel
|
||||
mode={mode}
|
||||
open={mode === BGStatusIndicatorModes.LapWide}
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
>LAP</LapLabel>
|
||||
<LapCount
|
||||
mode={mode}
|
||||
open={mode === BGStatusIndicatorModes.LapWide}
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
>
|
||||
<span>{lapCount} / {scheduledLaps}</span>
|
||||
</LapCount>
|
||||
</>
|
||||
)}
|
||||
</StatusIndicatorLayout>
|
||||
</StatusIndicatorBase>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import styled from "styled-components";
|
||||
import { BGStatusIndicatorModes } from "../../../../types/state";
|
||||
|
||||
import { DirectionalTransitionProps } from "../../../../types/style";
|
||||
import { commonDirectionalTransition } from "../../../../utils/styling";
|
||||
@@ -15,3 +16,105 @@ export const StatusIndicatorBase = styled.div<DirectionalTransitionProps>`
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
StatusIndicatorBase.displayName = "StatusIndicatorBase";
|
||||
|
||||
|
||||
export const StatusIndicatorLayout = styled.div`
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
`;
|
||||
StatusIndicatorLayout.displayName = "StatusIndicatorLayout";
|
||||
|
||||
type IndicatorModeProps = {
|
||||
mode: BGStatusIndicatorModes,
|
||||
};
|
||||
|
||||
|
||||
////// Lap Indicator Mode Styles //////
|
||||
type LapLineProps = DirectionalTransitionProps & IndicatorModeProps;
|
||||
export const LapLine = styled.div<LapLineProps>`
|
||||
position: absolute;
|
||||
top: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 33 : mode === BGStatusIndicatorModes.LapWide ? 5 : 0}px;
|
||||
left: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 30 : mode === BGStatusIndicatorModes.LapWide ? 128 : 0}px;
|
||||
|
||||
opacity: ${({ open }) => open ? 1 : 0};
|
||||
|
||||
width: ${({ mode, open }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? (90 * (open ? 1 : 0.3)) : mode === BGStatusIndicatorModes.LapWide ? 3 : 0}px;
|
||||
height: ${({ mode, open }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 3 : mode === BGStatusIndicatorModes.LapWide ? (60 * (open ? 1 : 0.3)) : 0}px;
|
||||
|
||||
background-color: ${p => p.theme.colors.textWhite};
|
||||
border: 1px solid ${p => p.theme.colors.dimGrey};
|
||||
mask-image: linear-gradient(
|
||||
to ${({ mode }) => mode === BGStatusIndicatorModes.LapNarrow ? "left" : "bottom"},
|
||||
transparent 0,
|
||||
#000000cc 40%,
|
||||
#000000cc 50%,
|
||||
#000000cc 60%,
|
||||
transparent 100%
|
||||
);
|
||||
|
||||
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
LapLine.displayName = "LapLine";
|
||||
|
||||
|
||||
type LapLabelProps = DirectionalTransitionProps & IndicatorModeProps;
|
||||
export const LapLabel = styled.span<LapLabelProps>`
|
||||
position: absolute;
|
||||
top: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 6 : mode === BGStatusIndicatorModes.LapWide ? 22 : 0}px;
|
||||
left: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 33 : mode === BGStatusIndicatorModes.LapWide ? 25 : 0}px;
|
||||
|
||||
font-family: ${p => p.theme.fonts.f1Wide};
|
||||
font-size: ${p => p.theme.fontSizes.indicatorLapLabel};
|
||||
color: ${p => p.theme.colors.textWhite};
|
||||
|
||||
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
LapLabel.displayName = "LapLabel";
|
||||
|
||||
|
||||
type LapCountProps = DirectionalTransitionProps & IndicatorModeProps;
|
||||
export const LapCount = styled.div<LapCountProps>`
|
||||
position: absolute;
|
||||
top: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 41 : mode === BGStatusIndicatorModes.LapWide ? 24 : 0}px;
|
||||
left: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 72 : mode === BGStatusIndicatorModes.LapWide ? 185 : 0}px;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
width: 0;
|
||||
height: ${p => p.theme.fontSizes.indicatorLapCount};
|
||||
overflow-y: clip;
|
||||
|
||||
> span {
|
||||
font-family: ${p => p.theme.fonts.f1Regular};
|
||||
font-size: ${p => p.theme.fontSizes.indicatorLapCount};
|
||||
color: ${p => p.theme.colors.textWhite};
|
||||
|
||||
font-feature-settings: 'tnum' 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
LapCount.displayName = "LapCount";
|
||||
@@ -206,7 +206,7 @@ export const DriverName = styled.span<DirectionalTransitionProps>`
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
color: white;
|
||||
color: ${p => p.theme.colors.textWhite};
|
||||
font-family: ${p => p.theme.fonts.f1Bold};
|
||||
font-size: 20px;
|
||||
text-transform: uppercase;
|
||||
@@ -218,8 +218,6 @@ export const DriverName = styled.span<DirectionalTransitionProps>`
|
||||
DriverName.displayName = "DriverName";
|
||||
|
||||
export const DriverNameWipe = styled.div<DirectionalTransitionProps>`
|
||||
/* background: #deadbe; */
|
||||
|
||||
width: ${({ open }) => open ? 800 : 200}px;
|
||||
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
||||
|
||||
@@ -237,7 +235,7 @@ type TimeDiffProps = DirectionalTransitionProps & {
|
||||
yScale: Fraction,
|
||||
};
|
||||
export const TimeDiff = styled.span<TimeDiffProps>`
|
||||
color: white;
|
||||
color: ${p => p.theme.colors.textWhite};
|
||||
font-family: ${p => p.theme.fonts.f1Regular};
|
||||
font-size: 20px;
|
||||
|
||||
|
||||
+13
@@ -55,6 +55,19 @@ export function TimingTowerPrototypeControls() {
|
||||
>
|
||||
+100m performance to all
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
dispatch(increaseDistance({
|
||||
cars: grid,
|
||||
distance: 1000,
|
||||
randomness: 0.05,
|
||||
usePerformance: true,
|
||||
}));
|
||||
dispatch(refreshRunningOrder());
|
||||
}}
|
||||
>
|
||||
+1000m performance to all
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
dispatch(setCarStatus({
|
||||
|
||||
@@ -91,6 +91,7 @@ export const workspaces: WorkspaceObject = {
|
||||
"timing-board-leader-20-out-1.png",
|
||||
"timing-board-intervals-yellow-flag.png",
|
||||
"timing-board-portrait-gap.png",
|
||||
"timing-board-fastest-lap-wide.png",
|
||||
],
|
||||
previewWindowDimensions: {
|
||||
width: 700,
|
||||
|
||||
@@ -41,7 +41,8 @@ const initialState: RootState["event"] = {
|
||||
progress: {
|
||||
startTime: Date.now(),
|
||||
timeLimit: 60 * 60 * 2 * 1000,
|
||||
lapCount: 44,
|
||||
lapCount: 1,
|
||||
scheduledLaps: 44,
|
||||
},
|
||||
leaderGridSpot: 0,
|
||||
grid: [
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 125 KiB |
@@ -24,8 +24,10 @@ export const theme = {
|
||||
lightGrey: "#ddd",
|
||||
faintGrey: "#eee",
|
||||
darkGrey: "#303030",
|
||||
dimGrey: "#999",
|
||||
videoFrameBG: "#333",
|
||||
positionFlagBG: "#f4f3ee",
|
||||
textWhite: "#f1f1f1", // I found it to be #f2f2f2 but whatever
|
||||
teams: { // 2021 Season
|
||||
alfaRomeo: "#900000",
|
||||
alphaTauri: "#2b4562",
|
||||
@@ -65,6 +67,8 @@ export const theme = {
|
||||
fontSizes: {
|
||||
label: "0.9em",
|
||||
selector: "0.9em",
|
||||
indicatorLapLabel: "1.2em",
|
||||
indicatorLapCount: "1.5em",
|
||||
},
|
||||
design: {
|
||||
statusIndicator: {
|
||||
|
||||
@@ -83,6 +83,7 @@ export interface EventProgress {
|
||||
startTime: Milliseconds;
|
||||
timeLimit: Milliseconds;
|
||||
lapCount: number;
|
||||
scheduledLaps: number;
|
||||
}
|
||||
export enum EventMode {
|
||||
Race,
|
||||
|
||||
Reference in new issue
Block a user