ISSUE-045 - Venetian Blinds - Wipe, blinds closing, and blinds color all working.

This commit is contained in:
Kyle Geib committed 2022-02-08 11:27:27 -05:00
1 parent 3ce590d794
commit 78073b1eb2
5 files changed
+102 -28

No files matched your search

@@ -1,23 +1,43 @@
import { animated } from "@react-spring/web";
import styled from "styled-components";
import { Px } from "../../../../types/style";
import { Degrees, Px } from "../../../../types/style";
import { Milliseconds } from "../../../../types/util";
type VenetianBlindsFilterProps = {
deg: number,
blindsAngle: Degrees,
transparentWidth: Px,
opaqueWidth: Px,
opaqueColor: string,
blindsColor: string,
blindsColorFadeDuration: Milliseconds,
blindsColorFadeDelay?: Milliseconds,
blindsClosed: boolean,
mirror?: boolean,
};
export const VenetianBlindsFilter = styled.div<VenetianBlindsFilterProps>`
position: ${({ mirror }) => mirror ? "absolute" : null};
--A: ${({ mirror }) => mirror ? "transparent" : "black"};
--B: ${({ mirror }) => mirror ? "black" : "transparent"};
mask-image: repeating-linear-gradient(
${({ deg }) => deg}deg,
black,
black ${({ opaqueWidth }) => opaqueWidth}px,
transparent ${({ opaqueWidth }) => opaqueWidth}px,
transparent ${({ transparentWidth, opaqueWidth }) => transparentWidth + opaqueWidth}px
${({ blindsAngle }) => blindsAngle}deg,
var(--A),
var(--A) ${({ opaqueWidth }) => opaqueWidth}px,
var(--B) ${({ opaqueWidth }) => opaqueWidth}px,
var(--B) ${({ transparentWidth, opaqueWidth }) => transparentWidth + opaqueWidth}px
);
> * {
box-shadow: inset 0 0 0 99999px ${({ opaqueColor }) => opaqueColor};
box-shadow: inset 0 0 0 99999px ${({ blindsColor, blindsClosed }) =>
`${blindsColor}${blindsClosed ? "00" : "cc"}`};
transition: box-shadow
${({ blindsColorFadeDuration }) => blindsColorFadeDuration}ms
cubic-bezier(0.88, 0.18, 0.96, 0.75)
${({ blindsColorFadeDelay = 0 }) => blindsColorFadeDelay}ms;
}
`;
VenetianBlindsFilter.displayName = "VenetianBlindsFilter";
export const AnimatedVenetianBlindsFilter = animated(VenetianBlindsFilter);
AnimatedVenetianBlindsFilter.displayName = "AnimatedVenetianBlindsFilter";