ISSUE-045 - Chyron Body - Great progress today! It's starting to look legit!
Massive change to the way that Chyrons are built and deployed. Still need to figure out what's wrong with the portrait and the Venetian blinds causing issues. Still need to make the team name flicker.
This commit is contained in:
1 parent
fd18703d1a
commit
b545750f70
6 files changed
+278
-64
No files matched your search
@@ -14,6 +14,7 @@ export function ChyronContainer() {
|
||||
<ChyronDriver
|
||||
chyronData={chyrons.driver.primary}
|
||||
subMode={chyrons.subMode}
|
||||
openState={chyrons.openState}
|
||||
/>
|
||||
);
|
||||
if (chyrons.subMode === "medium" && chyrons.driver.secondary) {
|
||||
@@ -23,6 +24,7 @@ export function ChyronContainer() {
|
||||
<ChyronDriver
|
||||
chyronData={chyrons.driver.secondary}
|
||||
subMode={chyrons.subMode}
|
||||
openState={chyrons.openState}
|
||||
/>
|
||||
</DoubleChyronContainer>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { BGChyronDriver, BGChyronSubMode } from "../../../../types/state";
|
||||
import { BGChyronDriver, BGChyronSubMode, OpenState } from "../../../../types/state";
|
||||
import { useSpring } from "@react-spring/web";
|
||||
|
||||
import { theme } from "../../../../shared/theme";
|
||||
|
||||
@@ -7,7 +8,11 @@ import { AngledFlag } from "../../Common/AngledFlag";
|
||||
import { PositionFlag } from "../../Common/PositionFlag";
|
||||
import { DriverPortrait } from "../../Common/DriverPortrait";
|
||||
import {
|
||||
BaseBackground,
|
||||
AnimatedBaseContainer,
|
||||
BaseLayout,
|
||||
BaseOutline,
|
||||
BaseBlack,
|
||||
BaseBackgroundColor,
|
||||
FirstName,
|
||||
LastName,
|
||||
NameContainer,
|
||||
@@ -17,15 +22,18 @@ import {
|
||||
TeamName,
|
||||
TextContainer,
|
||||
FlagContainer,
|
||||
BaseContainer,
|
||||
DriverPortraitContainer,
|
||||
} from "./styles";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { clearChyrons } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
||||
import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition";
|
||||
|
||||
type ChyronDriverProps = {
|
||||
chyronData: BGChyronDriver,
|
||||
subMode: BGChyronSubMode,
|
||||
openState: OpenState,
|
||||
};
|
||||
export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
|
||||
export function ChyronDriver({ chyronData, subMode, openState }: ChyronDriverProps) {
|
||||
const [baseWidth, baseHeight] = subMode === "medium" ? [582, 72]
|
||||
: subMode === "large" ? [638, 98]
|
||||
: [0, 0];
|
||||
@@ -35,15 +43,98 @@ export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
|
||||
? { flagMode, flag: car.driver.nationality }
|
||||
: flagMode === "team" ? { flagMode, flag: car.driver.team.id } : undefined;
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const containerFadeAwaySpring = useSpring({
|
||||
opacity: openState == -1 ? 0 : 1,
|
||||
config: { duration: 300 },
|
||||
delay: 0,
|
||||
onRest: () => {
|
||||
if (openState === -1) {
|
||||
dispatch(clearChyrons());
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const teamColor = theme.colors.teams[car.driver.team.id];
|
||||
|
||||
return (
|
||||
<BaseContainer width={baseWidth} height={baseHeight}>
|
||||
<BaseBackground >
|
||||
<AnimatedBaseContainer
|
||||
width={baseWidth}
|
||||
height={baseHeight}
|
||||
style={containerFadeAwaySpring}
|
||||
>
|
||||
<BaseOutline
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "outline",
|
||||
duration: 1000,
|
||||
}]}
|
||||
/>
|
||||
<BaseBlack
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 800,
|
||||
timing: "ease-in",
|
||||
}, {
|
||||
property: "width",
|
||||
duration: 400,
|
||||
timing: "ease-out",
|
||||
delay: 100,
|
||||
}]}
|
||||
/>
|
||||
<BaseLayout
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "clip-path",
|
||||
duration: 800,
|
||||
timing: "ease-in",
|
||||
}]}
|
||||
>
|
||||
<BaseBackgroundColor
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 600,
|
||||
delay: 900,
|
||||
}]}
|
||||
teamColor={teamColor}
|
||||
/>
|
||||
<Spacer width="6px" />
|
||||
{showPosFlag && (
|
||||
<PositionFlag size={baseHeight * 0.85} number={car.position} />
|
||||
<VenetianBlindsTransition
|
||||
visible={openState !== 0}
|
||||
delay={500}
|
||||
blindsColor="#f60d0d"
|
||||
blindsColorFadeDuration={300}
|
||||
blindsColorFadeDelay={200}
|
||||
blindsAngle={-45}
|
||||
blindsOpenDuration={100}
|
||||
blindsOpenDelay={150}
|
||||
blindsSize={{ transparent: 3, opaque: 6 }}
|
||||
wipeAngle={40}
|
||||
wipeDuration={300}
|
||||
wipeStartingCorner="bottomRight"
|
||||
opacityStart={0.1}
|
||||
opacityDuration={200}
|
||||
opacityDelay={100}
|
||||
spanBlinkDuration={500}
|
||||
>
|
||||
<PositionFlag size={baseHeight * 0.85} number={car.position} />
|
||||
</VenetianBlindsTransition>
|
||||
)}
|
||||
<Spacer width="8px" />
|
||||
<TeamColorBar color={theme.colors.teams[car.driver.team.id]} />
|
||||
<TeamColorBar
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "clip-path",
|
||||
duration: 750,
|
||||
timing: "ease-in-out",
|
||||
delay: 750,
|
||||
}]}
|
||||
color={teamColor}
|
||||
/>
|
||||
<Spacer width="8px" />
|
||||
<TextContainer>
|
||||
<NameContainer>
|
||||
@@ -62,6 +153,12 @@ export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
|
||||
<TeamName>{car.driver.team.shortName}</TeamName>
|
||||
</TextContainer>
|
||||
<FlagContainer
|
||||
open={openState !== 0}
|
||||
transitionProps={[{
|
||||
property: "opacity",
|
||||
duration: 500,
|
||||
delay: 1000,
|
||||
}]}
|
||||
height={baseHeight * 0.9}
|
||||
width={baseHeight * 3}
|
||||
right={-baseHeight * 0.6}
|
||||
@@ -73,16 +170,31 @@ export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
|
||||
/>
|
||||
)}
|
||||
</FlagContainer>
|
||||
</BaseBackground>
|
||||
</BaseLayout>
|
||||
{showPortrait && (
|
||||
<DriverPortraitContainer placement={{ right: "-5px", bottom: "0" }}>
|
||||
<DriverPortrait
|
||||
driverId={car.driver.id}
|
||||
height={baseHeight * 2.5}
|
||||
verticalOffsetPercentage={18}
|
||||
/>
|
||||
</DriverPortraitContainer>
|
||||
<VenetianBlindsTransition
|
||||
visible={openState !== 0}
|
||||
delay={1500}
|
||||
blindsColor={teamColor}
|
||||
blindsColorFadeDuration={600}
|
||||
blindsColorFadeDelay={300}
|
||||
blindsAngle={-45}
|
||||
blindsOpenDuration={600}
|
||||
blindsOpenDelay={600}
|
||||
blindsSize={{ transparent: 2, opaque: 5 }}
|
||||
wipeAngle={45}
|
||||
wipeDuration={600}
|
||||
wipeStartingCorner="bottomRight"
|
||||
>
|
||||
<DriverPortraitContainer placement={{ right: "-5px", bottom: "0" }}>
|
||||
<DriverPortrait
|
||||
driverId={car.driver.id}
|
||||
height={baseHeight * 2.5}
|
||||
verticalOffsetPercentage={18}
|
||||
/>
|
||||
</DriverPortraitContainer>
|
||||
</VenetianBlindsTransition>
|
||||
)}
|
||||
</BaseContainer>
|
||||
</AnimatedBaseContainer>
|
||||
);
|
||||
}
|
||||
@@ -1,42 +1,99 @@
|
||||
import { animated } from "@react-spring/web";
|
||||
import styled from "styled-components";
|
||||
import { Placement, Px } from "../../../../types/style";
|
||||
import { placementStyleRules } from "../../../../utils/styling";
|
||||
|
||||
type BaseContainerProps = {
|
||||
import { Placement, Px, TransitionArgs } from "../../../../types/style";
|
||||
import { commonTransition, placementStyleRules } from "../../../../utils/styling";
|
||||
|
||||
type TransitionProps = {
|
||||
open: boolean,
|
||||
transitionProps: TransitionArgs[],
|
||||
};
|
||||
|
||||
type AnimatedBaseContainerProps = {
|
||||
width: Px,
|
||||
height: Px,
|
||||
};
|
||||
export const BaseContainer = styled.div<BaseContainerProps>`
|
||||
position: relative;
|
||||
width: ${({ width }) => `${width}px`};
|
||||
height: ${({ height }) => `${height}px`};
|
||||
`;
|
||||
BaseContainer.displayName = "BaseContainer";
|
||||
export const AnimatedBaseContainer = animated(
|
||||
styled.div<AnimatedBaseContainerProps>`
|
||||
position: relative;
|
||||
width: ${({ width }) => `${width}px`};
|
||||
height: ${({ height }) => `${height}px`};
|
||||
`,
|
||||
);
|
||||
AnimatedBaseContainer.displayName = "AnimatedBaseContainer";
|
||||
|
||||
export const BaseBackground = styled.div`
|
||||
position: relative;
|
||||
const BaseShape = styled.div`
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
border-bottom-right-radius: 11px;
|
||||
`;
|
||||
|
||||
export const BaseOutline = styled(BaseShape)<TransitionProps>`
|
||||
width: 100%;
|
||||
opacity: ${({ open }) => open ? 1 : 0};
|
||||
outline: ${({ open }) => open
|
||||
? "2px solid #ffffff00"
|
||||
: "5px solid #ffffffff"};
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)};
|
||||
`;
|
||||
BaseOutline.displayName = "BaseOutline";
|
||||
|
||||
export const BaseBlack = styled(BaseShape)<TransitionProps>`
|
||||
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)<BaseBackgroundColorProps & TransitionProps>`
|
||||
width: 100%;
|
||||
|
||||
background-color: ${({ teamColor }) => teamColor};
|
||||
opacity: ${({ open }) => open ? 0 : 1};
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)};
|
||||
`;
|
||||
BaseBackgroundColor.displayName = "BaseBackgroundColor";
|
||||
|
||||
export const BaseLayout = styled(BaseShape)<TransitionProps>`
|
||||
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, -50% 100%, -50% 100%)"};
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)};
|
||||
`;
|
||||
BaseBackground.displayName = "BaseBackground";
|
||||
|
||||
type TeamColorBarProps = {
|
||||
color: string,
|
||||
};
|
||||
export const TeamColorBar = styled.div<TeamColorBarProps>`
|
||||
export const TeamColorBar = styled.div<TeamColorBarProps & TransitionProps>`
|
||||
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(0 0, 100% 0, 100% 0, 0 0)"};
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)};
|
||||
`;
|
||||
TeamColorBar.displayName = "TeamColorBar";
|
||||
|
||||
@@ -103,7 +160,7 @@ type FlagContainerProps = {
|
||||
width: Px,
|
||||
right: Px,
|
||||
};
|
||||
export const FlagContainer = styled.div<FlagContainerProps>`
|
||||
export const FlagContainer = styled.div<FlagContainerProps & TransitionProps>`
|
||||
position: absolute;
|
||||
right: ${({ right }) => `${right}px`};
|
||||
|
||||
@@ -115,6 +172,10 @@ export const FlagContainer = styled.div<FlagContainerProps>`
|
||||
width: ${({ width }) => `${width}px`};
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
opacity: ${({ open }) => open ? 1 : 0};
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)};
|
||||
`;
|
||||
FlagContainer.displayName = "FlagContainer";
|
||||
|
||||
|
||||
Reference in new issue
Block a user