ISSUE-045 - Venetian Blinds - Added blinking animation for the position number.
Activated with a blink duration. I had to consider a manual delay before starting. The animation delay didn't really work as the number would be visible until the animation started. I'm sure there's a solution but I'm a little lazy to figure it out at the moment. Otherwise, for future reference: iirc the delay would be 250ms and the duration would be 400ms.
This commit is contained in:
1 parent
177272df6f
commit
b1b3b62d3a
4 files changed
+40
-10
No files matched your search
+6
-2
@@ -21,6 +21,7 @@ type VenetianBlindsTransitionProps = {
|
|||||||
opacityStart?: Fraction,
|
opacityStart?: Fraction,
|
||||||
opacityDuration?: Milliseconds,
|
opacityDuration?: Milliseconds,
|
||||||
opacityDelay?: Milliseconds,
|
opacityDelay?: Milliseconds,
|
||||||
|
spanBlinkDuration?: Milliseconds,
|
||||||
};
|
};
|
||||||
export const VenetianBlindsTransition = (
|
export const VenetianBlindsTransition = (
|
||||||
{
|
{
|
||||||
@@ -37,6 +38,7 @@ export const VenetianBlindsTransition = (
|
|||||||
opacityStart = 1,
|
opacityStart = 1,
|
||||||
opacityDuration = wipeDuration,
|
opacityDuration = wipeDuration,
|
||||||
opacityDelay = 0,
|
opacityDelay = 0,
|
||||||
|
spanBlinkDuration,
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<VenetianBlindsTransitionProps>,
|
}: React.PropsWithChildren<VenetianBlindsTransitionProps>,
|
||||||
) => {
|
) => {
|
||||||
@@ -90,7 +92,8 @@ export const VenetianBlindsTransition = (
|
|||||||
blindsColor={blindsColor}
|
blindsColor={blindsColor}
|
||||||
blindsColorFadeDuration={blindsColorFadeDuration}
|
blindsColorFadeDuration={blindsColorFadeDuration}
|
||||||
blindsColorFadeDelay={blindsColorFadeDelay}
|
blindsColorFadeDelay={blindsColorFadeDelay}
|
||||||
blindsClosed={!!state}
|
blindsClosing={!!state}
|
||||||
|
spanBlinkDuration={spanBlinkDuration}
|
||||||
mirror={true} // Mirror version provides the opposite blinds.
|
mirror={true} // Mirror version provides the opposite blinds.
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
@@ -102,7 +105,8 @@ export const VenetianBlindsTransition = (
|
|||||||
blindsColor={blindsColor}
|
blindsColor={blindsColor}
|
||||||
blindsColorFadeDuration={blindsColorFadeDuration}
|
blindsColorFadeDuration={blindsColorFadeDuration}
|
||||||
blindsColorFadeDelay={blindsColorFadeDelay}
|
blindsColorFadeDelay={blindsColorFadeDelay}
|
||||||
blindsClosed={!!state}
|
blindsClosing={!!state}
|
||||||
|
spanBlinkDuration={spanBlinkDuration}
|
||||||
mirror={false}
|
mirror={false}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
import { animated } from "@react-spring/web";
|
import { animated } from "@react-spring/web";
|
||||||
import styled from "styled-components";
|
import styled, { css, keyframes } from "styled-components";
|
||||||
|
|
||||||
import { Degrees, Px } from "../../../../types/style";
|
import { Degrees, Px } from "../../../../types/style";
|
||||||
import { Milliseconds } from "../../../../types/util";
|
import { Milliseconds } from "../../../../types/util";
|
||||||
|
|
||||||
|
const spanBlinkAnimation = keyframes`
|
||||||
|
0% { opacity: 0 }
|
||||||
|
62% { opacity: 1 }
|
||||||
|
72% { opacity: 0 }
|
||||||
|
81% { opacity: 1 }
|
||||||
|
91% { opacity: 0 }
|
||||||
|
100% { opacity: 1 }
|
||||||
|
`;
|
||||||
|
|
||||||
type VenetianBlindsFilterProps = {
|
type VenetianBlindsFilterProps = {
|
||||||
blindsAngle: Degrees,
|
blindsAngle: Degrees,
|
||||||
transparentWidth: Px,
|
transparentWidth: Px,
|
||||||
@@ -11,8 +20,10 @@ type VenetianBlindsFilterProps = {
|
|||||||
blindsColor: string,
|
blindsColor: string,
|
||||||
blindsColorFadeDuration: Milliseconds,
|
blindsColorFadeDuration: Milliseconds,
|
||||||
blindsColorFadeDelay?: Milliseconds,
|
blindsColorFadeDelay?: Milliseconds,
|
||||||
blindsClosed: boolean,
|
blindsClosing: boolean,
|
||||||
mirror?: boolean,
|
mirror?: boolean,
|
||||||
|
spanBlinkDuration?: Milliseconds,
|
||||||
|
spanBlinkDelay?: Milliseconds,
|
||||||
};
|
};
|
||||||
export const VenetianBlindsFilter = styled.div<VenetianBlindsFilterProps>`
|
export const VenetianBlindsFilter = styled.div<VenetianBlindsFilterProps>`
|
||||||
position: ${({ mirror }) => mirror ? "absolute" : null};
|
position: ${({ mirror }) => mirror ? "absolute" : null};
|
||||||
@@ -29,13 +40,23 @@ export const VenetianBlindsFilter = styled.div<VenetianBlindsFilterProps>`
|
|||||||
);
|
);
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
box-shadow: inset 0 0 0 99999px ${({ blindsColor, blindsClosed }) =>
|
box-shadow: inset 0 0 0 99999px ${({ blindsColor, blindsClosing }) =>
|
||||||
`${blindsColor}${blindsClosed ? "00" : "cc"}`};
|
`${blindsColor}${blindsClosing ? "00" : "cc"}`};
|
||||||
transition: box-shadow
|
transition: box-shadow
|
||||||
${({ blindsColorFadeDuration }) => blindsColorFadeDuration}ms
|
${({ blindsColorFadeDuration }) => blindsColorFadeDuration}ms
|
||||||
cubic-bezier(0.88, 0.18, 0.96, 0.75)
|
cubic-bezier(0.88, 0.18, 0.96, 0.75)
|
||||||
${({ blindsColorFadeDelay = 0 }) => blindsColorFadeDelay}ms;
|
${({ blindsColorFadeDelay = 0 }) => blindsColorFadeDelay}ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${({ blindsClosing, spanBlinkDuration }) => (
|
||||||
|
blindsClosing && spanBlinkDuration
|
||||||
|
? css`
|
||||||
|
span {
|
||||||
|
animation: ${spanBlinkAnimation} ${spanBlinkDuration}ms step-end;
|
||||||
|
};
|
||||||
|
`
|
||||||
|
: null)
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
VenetianBlindsFilter.displayName = "VenetianBlindsFilter";
|
VenetianBlindsFilter.displayName = "VenetianBlindsFilter";
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { useDrag } from "@use-gesture/react";
|
|||||||
import useMeasure from "react-use-measure";
|
import useMeasure from "react-use-measure";
|
||||||
import { clamp } from "lodash";
|
import { clamp } from "lodash";
|
||||||
|
|
||||||
|
import { Fraction } from "../../../../types/style";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AnimatedProgressSliderBar,
|
AnimatedProgressSliderBar,
|
||||||
ProgressSliderBarHandle,
|
ProgressSliderBarHandle,
|
||||||
@@ -19,7 +21,7 @@ const MARGIN_WIDTH = 15;
|
|||||||
const percentage = (value: number) => `${Math.floor(value * 100)}%`;
|
const percentage = (value: number) => `${Math.floor(value * 100)}%`;
|
||||||
|
|
||||||
type ProgressSliderProps = {
|
type ProgressSliderProps = {
|
||||||
value: number, // Fraction of 1 (0.0 to 1.0)
|
value: Fraction,
|
||||||
onChange: (value: number) => void,
|
onChange: (value: number) => void,
|
||||||
disabled?: boolean,
|
disabled?: boolean,
|
||||||
formatter?: (value: number) => string,
|
formatter?: (value: number) => string,
|
||||||
|
|||||||
+6
-3
@@ -1,10 +1,12 @@
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||||
|
|
||||||
import { theme } from "../../../../shared/theme";
|
import { theme } from "../../../../shared/theme";
|
||||||
|
import { BasicBlock } from "../styles";
|
||||||
|
|
||||||
import { DriverPortrait } from "../../../BroadcastGraphics/Common/DriverPortrait";
|
import { DriverPortrait } from "../../../BroadcastGraphics/Common/DriverPortrait";
|
||||||
import { PositionFlag } from "../../../BroadcastGraphics/Common/PositionFlag";
|
import { PositionFlag } from "../../../BroadcastGraphics/Common/PositionFlag";
|
||||||
import { VenetianBlindsTransition } from "../../../BroadcastGraphics/Common/VenetianBlindsTransition";
|
import { VenetianBlindsTransition } from "../../../BroadcastGraphics/Common/VenetianBlindsTransition";
|
||||||
import { BasicBlock } from "../styles";
|
|
||||||
|
|
||||||
export function VenetianBlindsWorkspace() {
|
export function VenetianBlindsWorkspace() {
|
||||||
const { prototypeState } = useSelector(workspaceSelector);
|
const { prototypeState } = useSelector(workspaceSelector);
|
||||||
@@ -35,8 +37,8 @@ export function VenetianBlindsWorkspace() {
|
|||||||
) : (
|
) : (
|
||||||
<VenetianBlindsTransition
|
<VenetianBlindsTransition
|
||||||
blindsColor="#f60d0d"
|
blindsColor="#f60d0d"
|
||||||
blindsColorFadeDuration={200}
|
blindsColorFadeDuration={300}
|
||||||
blindsColorFadeDelay={100}
|
blindsColorFadeDelay={200}
|
||||||
blindsAngle={-45}
|
blindsAngle={-45}
|
||||||
blindsOpenDuration={100}
|
blindsOpenDuration={100}
|
||||||
blindsOpenDelay={100}
|
blindsOpenDelay={100}
|
||||||
@@ -47,6 +49,7 @@ export function VenetianBlindsWorkspace() {
|
|||||||
opacityStart={0.1}
|
opacityStart={0.1}
|
||||||
opacityDuration={200}
|
opacityDuration={200}
|
||||||
opacityDelay={100}
|
opacityDelay={100}
|
||||||
|
spanBlinkDuration={500}
|
||||||
>
|
>
|
||||||
<PositionFlag size={122} number={1} />
|
<PositionFlag size={122} number={1} />
|
||||||
</VenetianBlindsTransition>
|
</VenetianBlindsTransition>
|
||||||
|
|||||||
Reference in new issue
Block a user