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
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user