ISSUE-045 - Venetian Blinds - Calibrated portrait example to be more accurate to real example.
Added opacity props for the filter to allow for an opacity rule on the entire filter - as is apparent with the real position flag example.
This commit is contained in:
1 parent
78073b1eb2
commit
177272df6f
2 files changed
+22
-4
No files matched your search
+14
-1
@@ -4,7 +4,7 @@ import useMeasure from "react-use-measure";
|
|||||||
|
|
||||||
import { AnimatedVenetianBlindsFilter, VenetianBlindsFilter } from "./styles";
|
import { AnimatedVenetianBlindsFilter, VenetianBlindsFilter } from "./styles";
|
||||||
import { wipeCustomDegClip } from "../../../../utils/styling";
|
import { wipeCustomDegClip } from "../../../../utils/styling";
|
||||||
import { Corner, Degrees, Px } from "../../../../types/style";
|
import { Corner, Degrees, Fraction, Px } from "../../../../types/style";
|
||||||
import { Milliseconds } from "../../../../types/util";
|
import { Milliseconds } from "../../../../types/util";
|
||||||
|
|
||||||
type VenetianBlindsTransitionProps = {
|
type VenetianBlindsTransitionProps = {
|
||||||
@@ -18,6 +18,9 @@ type VenetianBlindsTransitionProps = {
|
|||||||
wipeAngle: Degrees,
|
wipeAngle: Degrees,
|
||||||
wipeDuration: Milliseconds,
|
wipeDuration: Milliseconds,
|
||||||
wipeStartingCorner: Corner,
|
wipeStartingCorner: Corner,
|
||||||
|
opacityStart?: Fraction,
|
||||||
|
opacityDuration?: Milliseconds,
|
||||||
|
opacityDelay?: Milliseconds,
|
||||||
};
|
};
|
||||||
export const VenetianBlindsTransition = (
|
export const VenetianBlindsTransition = (
|
||||||
{
|
{
|
||||||
@@ -31,6 +34,9 @@ export const VenetianBlindsTransition = (
|
|||||||
wipeAngle,
|
wipeAngle,
|
||||||
wipeDuration,
|
wipeDuration,
|
||||||
wipeStartingCorner,
|
wipeStartingCorner,
|
||||||
|
opacityStart = 1,
|
||||||
|
opacityDuration = wipeDuration,
|
||||||
|
opacityDelay = 0,
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<VenetianBlindsTransitionProps>,
|
}: React.PropsWithChildren<VenetianBlindsTransitionProps>,
|
||||||
) => {
|
) => {
|
||||||
@@ -46,6 +52,12 @@ export const VenetianBlindsTransition = (
|
|||||||
config: { duration: wipeDuration },
|
config: { duration: wipeDuration },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { opacity } = useSpring({
|
||||||
|
opacity: state ? 1 : opacityStart,
|
||||||
|
config: { duration: opacityDuration },
|
||||||
|
delay: opacityDelay,
|
||||||
|
});
|
||||||
|
|
||||||
const blindsSpring = useSpring({
|
const blindsSpring = useSpring({
|
||||||
opacity: state ? 1 : 0,
|
opacity: state ? 1 : 0,
|
||||||
config: { duration: blindsOpenDuration },
|
config: { duration: blindsOpenDuration },
|
||||||
@@ -56,6 +68,7 @@ export const VenetianBlindsTransition = (
|
|||||||
<div onClick={() => toggle(!state)}>
|
<div onClick={() => toggle(!state)}>
|
||||||
<animated.div
|
<animated.div
|
||||||
style={{
|
style={{
|
||||||
|
opacity,
|
||||||
clipPath: wipe.to(wipeProgress => {
|
clipPath: wipe.to(wipeProgress => {
|
||||||
const [a1, a2, b1, b2, c1, c2] = wipeCustomDegClip(
|
const [a1, a2, b1, b2, c1, c2] = wipeCustomDegClip(
|
||||||
childWidth,
|
childWidth,
|
||||||
|
|||||||
+8
-3
@@ -35,13 +35,18 @@ export function VenetianBlindsWorkspace() {
|
|||||||
) : (
|
) : (
|
||||||
<VenetianBlindsTransition
|
<VenetianBlindsTransition
|
||||||
blindsColor="#f60d0d"
|
blindsColor="#f60d0d"
|
||||||
blindsColorFadeDuration={400}
|
blindsColorFadeDuration={200}
|
||||||
|
blindsColorFadeDelay={100}
|
||||||
blindsAngle={-45}
|
blindsAngle={-45}
|
||||||
blindsOpenDuration={120}
|
blindsOpenDuration={100}
|
||||||
|
blindsOpenDelay={100}
|
||||||
blindsSize={{ transparent: 3, opaque: 6 }}
|
blindsSize={{ transparent: 3, opaque: 6 }}
|
||||||
wipeAngle={40}
|
wipeAngle={40}
|
||||||
wipeDuration={200}
|
wipeDuration={300}
|
||||||
wipeStartingCorner="bottomRight"
|
wipeStartingCorner="bottomRight"
|
||||||
|
opacityStart={0.1}
|
||||||
|
opacityDuration={200}
|
||||||
|
opacityDelay={100}
|
||||||
>
|
>
|
||||||
<PositionFlag size={122} number={1} />
|
<PositionFlag size={122} number={1} />
|
||||||
</VenetianBlindsTransition>
|
</VenetianBlindsTransition>
|
||||||
|
|||||||
Reference in new issue
Block a user