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:
Kyle Geib committed 2022-02-08 12:23:32 -05:00
1 parent 177272df6f
commit b1b3b62d3a
4 files changed
+40 -10

No files matched your search

@@ -1,9 +1,18 @@
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 { 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 = {
blindsAngle: Degrees,
transparentWidth: Px,
@@ -11,8 +20,10 @@ type VenetianBlindsFilterProps = {
blindsColor: string,
blindsColorFadeDuration: Milliseconds,
blindsColorFadeDelay?: Milliseconds,
blindsClosed: boolean,
blindsClosing: boolean,
mirror?: boolean,
spanBlinkDuration?: Milliseconds,
spanBlinkDelay?: Milliseconds,
};
export const VenetianBlindsFilter = styled.div<VenetianBlindsFilterProps>`
position: ${({ mirror }) => mirror ? "absolute" : null};
@@ -29,13 +40,23 @@ export const VenetianBlindsFilter = styled.div<VenetianBlindsFilterProps>`
);
> * {
box-shadow: inset 0 0 0 99999px ${({ blindsColor, blindsClosed }) =>
`${blindsColor}${blindsClosed ? "00" : "cc"}`};
box-shadow: inset 0 0 0 99999px ${({ blindsColor, blindsClosing }) =>
`${blindsColor}${blindsClosing ? "00" : "cc"}`};
transition: box-shadow
${({ blindsColorFadeDuration }) => blindsColorFadeDuration}ms
cubic-bezier(0.88, 0.18, 0.96, 0.75)
${({ blindsColorFadeDelay = 0 }) => blindsColorFadeDelay}ms;
}
${({ blindsClosing, spanBlinkDuration }) => (
blindsClosing && spanBlinkDuration
? css`
span {
animation: ${spanBlinkAnimation} ${spanBlinkDuration}ms step-end;
};
`
: null)
}
`;
VenetianBlindsFilter.displayName = "VenetianBlindsFilter";