Skip to content

Commit 755d32d

Browse files
committed
add support for opacity effect
1 parent b791ffa commit 755d32d

File tree

7 files changed

+46
-6
lines changed

7 files changed

+46
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
}
7575
],
7676
"dependencies": {
77-
"parallax-controller": "0.1.13"
77+
"parallax-controller": "0.1.14"
7878
},
7979
"devDependencies": {
8080
"@babel/core": "^7.16.0",

src/components/Parallax/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function Parallax(props: PropsWithChildren<ParallaxProps>) {
4949
scaleX: props.scaleX,
5050
scaleY: props.scaleY,
5151
scaleZ: props.scaleZ,
52+
opacity: props.opacity,
5253
}),
5354
};
5455
}
@@ -88,6 +89,7 @@ export function Parallax(props: PropsWithChildren<ParallaxProps>) {
8889
props.scaleY,
8990
props.scaleZ,
9091
props.speed,
92+
props.opacity,
9193
]);
9294

9395
const Outer = props.tagOuter;

src/components/Parallax/types.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ export interface ParallaxProps {
120120
* Second value is the ending scale
121121
*/
122122
scaleZ?: number[];
123+
/**
124+
* Start and end opacity value
125+
*
126+
* Example:
127+
*
128+
* opacity={[0, 1]}
129+
*
130+
* First value is the starting opacity
131+
* Second value is the ending opacity
132+
*/
133+
opacity?: number[];
123134
/**
124135
* Optionally pass additional class names to be added to the outermost parallax element.
125136
*/

stories/Parallax/0_ParallaxExamples.stories.tsx renamed to stories/Parallax/0_ParallaxRotation.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ WithTranslateYAndRotation.args = {
7171
};
7272

7373
export default {
74-
title: '<Parallax> New Transforms',
74+
title: '<Parallax> Rotation',
7575
component: WithRotation,
7676
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import { Parallax } from '../../src';
3+
import { Element } from '../Element/Element';
4+
import { Container } from '../Container';
5+
import styles from './Parallax.module.scss';
6+
7+
const Template = (args) => {
8+
const props = args;
9+
return (
10+
<Container scrollAxis="vertical" className={styles.elements}>
11+
<Parallax {...props} className={styles.parallax}>
12+
<Element name="A" />
13+
</Parallax>
14+
</Container>
15+
);
16+
};
17+
18+
export const WithOpacity = Template.bind({});
19+
20+
WithOpacity.args = {
21+
opacity: [0, 1],
22+
};
23+
24+
export default {
25+
title: '<Parallax> Opacity',
26+
component: WithOpacity,
27+
};

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11050,10 +11050,10 @@ pako@~1.0.5:
1105011050
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
1105111051
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==
1105211052

11053-
parallax-controller@0.1.13:
11054-
version "0.1.13"
11055-
resolved "https://registry.yarnpkg.com/parallax-controller/-/parallax-controller-0.1.13.tgz#5e93b76cc849f1f96ee5915d547a0c98f3b244ff"
11056-
integrity sha512-rvUBtY/ebt5Z3hK6cZ9n2LoeYn5+AeZ273/UZbXuQFcgCizQtFt7x1/8zb4BrL09EwFWsx+HSQD2gg2UwzUicg==
11053+
parallax-controller@0.1.14:
11054+
version "0.1.14"
11055+
resolved "https://registry.yarnpkg.com/parallax-controller/-/parallax-controller-0.1.14.tgz#aee3459754fe08ca29898fc1b8721d785737cdae"
11056+
integrity sha512-lzrnXq/kMUqZ5IwPNK/kzHR4obBYgeBEzijt/zqAkLJ7AAHvhdtoizb+wyVfmpGK5OCFAthwl/9q9kIrAHu7qw==
1105711057

1105811058
parallel-transform@^1.1.0:
1105911059
version "1.2.0"

0 commit comments

Comments
 (0)