ISSUE-078 - Added RolexGem. Positioned and animated.
Also took some time to move a lot of timing properties from ChyronDriver and place them in the central theme.
This commit is contained in:
1 parent
3f1e3b0c54
commit
f8fd7e2147
10 files changed
+196
-50
No files matched your search
@@ -14,7 +14,7 @@ import {
|
||||
setChyronsOpenState,
|
||||
} from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
||||
import { flagModeList, getChyronModesList, getChyronSubModesList } from "../../../../domain/data/broadcastGraphics";
|
||||
import { BGChyronDriver, BGChyronMode, BGChyrons, BGChyronSubMode, Car, FlagMode, GridSpot } from "../../../../types/state";
|
||||
import { BGChyronDriver, BGChyronMode, BGChyrons, BGChyronSubMode, FlagMode, GridSpot } from "../../../../types/state";
|
||||
|
||||
import { SlotSelector } from "../../../Common/Inputs/SlotSelector";
|
||||
import { Button, CloseButton, OpenButton, Title } from "./styles";
|
||||
|
||||
@@ -22,6 +22,7 @@ export function ChyronContainer({ debug = false, placement = {} }: ChyronContain
|
||||
chyronData={chyrons.driver.primary}
|
||||
subMode={chyrons.subMode}
|
||||
openState={chyrons.openState}
|
||||
showRolex
|
||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||
/>
|
||||
);
|
||||
@@ -35,6 +36,7 @@ export function ChyronContainer({ debug = false, placement = {} }: ChyronContain
|
||||
chyronData={chyrons.driver.secondary}
|
||||
subMode={chyrons.subMode}
|
||||
openState={chyrons.openState}
|
||||
showRolex={false}
|
||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||
/>
|
||||
</DoubleChyronContainer>
|
||||
|
||||
@@ -30,16 +30,19 @@ import {
|
||||
} from "./styles";
|
||||
import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition";
|
||||
import { Spacer } from "../../Common/Spacer.styled";
|
||||
import { RolexGem } from "../../Gems/RolexGem";
|
||||
|
||||
type ChyronDriverProps = DebugDurationProps & {
|
||||
chyronData: BGChyronDriver,
|
||||
subMode: BGChyronSubMode,
|
||||
openState: OpenState,
|
||||
showRolex: boolean,
|
||||
};
|
||||
export function ChyronDriver({
|
||||
chyronData,
|
||||
subMode,
|
||||
openState,
|
||||
showRolex,
|
||||
debugDurationMultiplier: DDM = 1.0,
|
||||
}: ChyronDriverProps) {
|
||||
const [baseWidth, baseHeight] = subMode === "medium" ? [582, 72]
|
||||
@@ -58,9 +61,12 @@ export function ChyronDriver({
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const { design: { chyronDriver: cdTheme } } = theme;
|
||||
const teamColor = theme.colors.teams[car.driver.team.id];
|
||||
|
||||
const containerFadeAwaySpring = useSpring({
|
||||
opacity: openState == -1 ? 0 : 1,
|
||||
config: { duration: 300 * DDM },
|
||||
config: { duration: cdTheme.containerFadeAwayDurationMs * DDM },
|
||||
delay: 0,
|
||||
onRest: () => {
|
||||
if (openState === -1) {
|
||||
@@ -71,18 +77,19 @@ export function ChyronDriver({
|
||||
|
||||
const { outlineClipPathProgress } = useSpring({
|
||||
outlineClipPathProgress: openState !== 0 ? 1 : 0,
|
||||
config: { duration: 500 * DDM },
|
||||
config: { duration: cdTheme.outlineClipPathDurationMs * DDM },
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
const teamColor = theme.colors.teams[car.driver.team.id];
|
||||
|
||||
return (
|
||||
<AnimatedBaseContainer
|
||||
width={baseWidth}
|
||||
height={baseHeight}
|
||||
style={containerFadeAwaySpring}
|
||||
>
|
||||
{showRolex && (
|
||||
<RolexGem openState={openState} debugDurationMultiplier={DDM} />
|
||||
)}
|
||||
<AnimatedBaseOutline
|
||||
open={openState !== 0}
|
||||
startThickness={5}
|
||||
@@ -91,7 +98,7 @@ export function ChyronDriver({
|
||||
endColor="#ffffff00"
|
||||
transitionProps={[{
|
||||
property: "outline",
|
||||
duration: 1167 * DDM,
|
||||
duration: cdTheme.outlineFadeDurationMs * DDM,
|
||||
}]}
|
||||
style={{
|
||||
clipPath: outlineClipPathProgress.to(progress => {
|
||||
@@ -109,11 +116,11 @@ export function ChyronDriver({
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 800 * DDM,
|
||||
duration: cdTheme.baseBlackOpacityDurationMs * DDM,
|
||||
timing: "ease-in",
|
||||
}, {
|
||||
property: "width",
|
||||
duration: 667 * DDM,
|
||||
duration: cdTheme.baseBlackWidthDurationMs * DDM,
|
||||
timing: "ease-out",
|
||||
}]}
|
||||
/>
|
||||
@@ -121,17 +128,17 @@ export function ChyronDriver({
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "clip-path",
|
||||
duration: 400 * DDM,
|
||||
duration: cdTheme.baseWipeDurationMs * DDM,
|
||||
timing: "ease-in",
|
||||
delay: 333 * DDM,
|
||||
delay: cdTheme.baseWipeDelay * DDM,
|
||||
}]}
|
||||
>
|
||||
<BaseBackgroundColor
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 566 * DDM,
|
||||
delay: 600 * DDM,
|
||||
duration: cdTheme.baseColorDurationMs * DDM,
|
||||
delay: cdTheme.baseColorDelayMs * DDM,
|
||||
}]}
|
||||
teamColor={teamColor}
|
||||
/>
|
||||
@@ -139,21 +146,21 @@ export function ChyronDriver({
|
||||
{showPosFlag && car.status !== CarStatus.Retired && (
|
||||
<VenetianBlindsTransition
|
||||
visible={openState !== 0}
|
||||
delay={500 * DDM}
|
||||
blindsColor="#f60d0d"
|
||||
blindsColorFadeDuration={300 * DDM}
|
||||
blindsColorFadeDelay={200 * DDM}
|
||||
blindsAngle={-45}
|
||||
blindsOpenDuration={100 * DDM}
|
||||
blindsOpenDelay={150 * DDM}
|
||||
blindsSize={{ transparent: 3, opaque: 6 }}
|
||||
wipeAngle={40}
|
||||
wipeDuration={333 * DDM}
|
||||
delay={cdTheme.posFlagBlindsDelayMs * DDM}
|
||||
blindsColor={cdTheme.posFlagBlindsColor}
|
||||
blindsColorFadeDuration={cdTheme.posFlagBlindsColorFadeDurationMs * DDM}
|
||||
blindsColorFadeDelay={cdTheme.posFlagBlindsColorFadeDelayMs * DDM}
|
||||
blindsAngle={cdTheme.posFlagBlindsAngleDeg}
|
||||
blindsOpenDuration={cdTheme.posFlagBlindsOpenDurationMs * DDM}
|
||||
blindsOpenDelay={cdTheme.posFlagBlindsOpenDelayMs * DDM}
|
||||
blindsSize={cdTheme.posFlagBlindsBlindsSize}
|
||||
wipeAngle={cdTheme.posFlagWipeAngleDeg}
|
||||
wipeDuration={cdTheme.posFlagWipeDuration * DDM}
|
||||
wipeStartingCorner="bottomRight"
|
||||
opacityStart={0.1}
|
||||
opacityDuration={200 * DDM}
|
||||
opacityDelay={100 * DDM}
|
||||
spanBlinkDuration={500 * DDM}
|
||||
opacityStart={cdTheme.posFlagOpacityStartFraction}
|
||||
opacityDuration={cdTheme.posFlagOpacityDurationMs * DDM}
|
||||
opacityDelay={cdTheme.posFlagOpacityDelayMs * DDM}
|
||||
spanBlinkDuration={cdTheme.posFlagSpanBlinkDurationMs * DDM}
|
||||
>
|
||||
<PositionFlag size={baseHeight * 0.85} number={car.position} />
|
||||
</VenetianBlindsTransition>
|
||||
@@ -163,9 +170,9 @@ export function ChyronDriver({
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "clip-path",
|
||||
duration: 667 * DDM,
|
||||
duration: cdTheme.teamColorBarDurationMs * DDM,
|
||||
timing: "ease-in-out",
|
||||
delay: 733 * DDM,
|
||||
delay: cdTheme.teamColorBarDelayMs * DDM,
|
||||
}]}
|
||||
color={teamColor}
|
||||
/>
|
||||
@@ -186,8 +193,8 @@ export function ChyronDriver({
|
||||
</NameContainer>
|
||||
<TeamName
|
||||
open={openState !== 0}
|
||||
duration={233 * DDM}
|
||||
delay={500 * DDM}
|
||||
duration={cdTheme.teamNameAnimationDurationMs * DDM}
|
||||
delay={cdTheme.teamNameAnimationDelayMs * DDM}
|
||||
>
|
||||
{car.driver.team.shortName}
|
||||
</TeamName>
|
||||
@@ -196,12 +203,12 @@ export function ChyronDriver({
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 1200 * DDM,
|
||||
delay: 1000 * DDM,
|
||||
duration: cdTheme.flagOpacityDurationMs * DDM,
|
||||
delay: cdTheme.flagDelay * DDM,
|
||||
}, {
|
||||
property: "right",
|
||||
duration: 2000 * DDM,
|
||||
delay: 1000 * DDM,
|
||||
duration: cdTheme.flagRightDuration * DDM,
|
||||
delay: cdTheme.flagDelay * DDM,
|
||||
}]}
|
||||
height={baseHeight * 0.9}
|
||||
width={baseHeight * 3}
|
||||
@@ -220,23 +227,23 @@ export function ChyronDriver({
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 500 * DDM,
|
||||
delay: 2000 * DDM,
|
||||
duration: cdTheme.portraitOpacityDurationMs * DDM,
|
||||
delay: cdTheme.portraitOpacityDelayMs * DDM,
|
||||
}]}
|
||||
placement={{ right: "-5px", bottom: "0" }}
|
||||
placement={cdTheme.portraitPlacement}
|
||||
>
|
||||
<VenetianBlindsTransition
|
||||
visible={openState !== 0}
|
||||
delay={1700 * DDM}
|
||||
delay={cdTheme.portraitBlindsDelayMs * DDM}
|
||||
blindsColor={teamColor}
|
||||
blindsColorFadeDuration={600 * DDM}
|
||||
blindsColorFadeDelay={0 * DDM}
|
||||
blindsAngle={-45}
|
||||
blindsOpenDuration={300 * DDM}
|
||||
blindsOpenDelay={0 * DDM}
|
||||
blindsSize={{ transparent: 2, opaque: 5 }}
|
||||
wipeAngle={45}
|
||||
wipeDuration={700 * DDM}
|
||||
blindsColorFadeDuration={cdTheme.portraitBlindsColorFadeDurationMs * DDM}
|
||||
blindsColorFadeDelay={cdTheme.portraitBlindsColorFadeDelayMs * DDM}
|
||||
blindsAngle={cdTheme.portraitBlindsAngleDeg}
|
||||
blindsOpenDuration={cdTheme.portraitBlindsOpenDurationMs * DDM}
|
||||
blindsOpenDelay={cdTheme.portraitBlindsOpenDelayMs * DDM}
|
||||
blindsSize={cdTheme.portraitBlindsSize}
|
||||
wipeAngle={cdTheme.portraitWipeAngleDeg}
|
||||
wipeDuration={cdTheme.portraitWipeDurationMs * DDM}
|
||||
wipeStartingCorner="bottomRight"
|
||||
>
|
||||
<DriverPortrait
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import { OpenState } from "../../../../types/state";
|
||||
import { DebugDurationProps } from "../../../../types/style";
|
||||
import { LogoImage, GemBackground, GemContainer } from "./styles";
|
||||
|
||||
import rolexLogo from "../../../../public/images/logos/rolex-yellow.svg";
|
||||
|
||||
type RolexGemProps = DebugDurationProps & {
|
||||
openState: OpenState,
|
||||
};
|
||||
export function RolexGem({
|
||||
openState,
|
||||
debugDurationMultiplier: DDM = 1.0,
|
||||
}: RolexGemProps) {
|
||||
return (
|
||||
<GemContainer
|
||||
open={openState > 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: theme.design.rolexGem.fadeInDurationMs * DDM,
|
||||
delay: theme.design.rolexGem.fadeInDelayMs * DDM,
|
||||
}]}
|
||||
>
|
||||
<GemBackground>
|
||||
<LogoImage
|
||||
src={rolexLogo}
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "height",
|
||||
duration: theme.design.rolexGem.fadeInDurationMs * 2 * DDM,
|
||||
delay: theme.design.rolexGem.fadeInDelayMs * DDM,
|
||||
timing: "ease-out",
|
||||
}, {
|
||||
property: "opacity",
|
||||
duration: theme.design.rolexGem.fadeInDurationMs * 2 * DDM,
|
||||
delay: theme.design.rolexGem.fadeInDelayMs * 1.2 * DDM,
|
||||
}]}
|
||||
/>
|
||||
</GemBackground>
|
||||
</GemContainer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./RolexGem";
|
||||
@@ -0,0 +1,38 @@
|
||||
import styled from "styled-components/macro";
|
||||
|
||||
import { TransitionProps } from "../../../../types/style";
|
||||
import { commonTransition } from "../../../../utils/styling";
|
||||
|
||||
export const GemContainer = styled.div<TransitionProps>`
|
||||
position: absolute;
|
||||
top: ${p =>
|
||||
-p.theme.design.rolexGem.heightPx - p.theme.design.rolexGem.bottomMarginPx}px;
|
||||
|
||||
opacity: ${({ open }) => open ? 1 : 0};
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)}
|
||||
`;
|
||||
|
||||
export const GemBackground = styled.div`
|
||||
position: relative;
|
||||
height: ${p => p.theme.design.rolexGem.heightPx}px;
|
||||
width: ${p => p.theme.design.rolexGem.widthPx}px;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
background-color: ${p => p.theme.colors.logos.rolexGemGreen};
|
||||
border-radius: ${p => p.theme.design.rolexGem.borderRadiusPx}px;
|
||||
`;
|
||||
|
||||
export const LogoImage = styled.img<TransitionProps>`
|
||||
height: ${({ theme: { design: { rolexGem } }, open }) =>
|
||||
rolexGem.logoHeightPx * (open ? 1 : rolexGem.logoHeightFadeStartFraction)}px;
|
||||
margin-top: ${p => p.theme.design.rolexGem.logoTopMarginPx}px;
|
||||
opacity: ${({ theme: { design: { rolexGem } }, open }) => open
|
||||
? 1 : rolexGem.logoOpacityFadeStartFraction};
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)}
|
||||
`;
|
||||
|
||||
Reference in new issue
Block a user