Archived
Merge branch 'master' of https://github.com/makoteq/eco-hack
This commit is contained in:
commit
41a50eb15b
1 file changed
+25
@@ -0,0 +1,25 @@
|
|||||||
|
function HoldingPlant() {
|
||||||
|
return (
|
||||||
|
const wrapper = useRef(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const [elements] = wrapper.current.children;
|
||||||
|
|
||||||
|
const plant = elements.getElementById("plant");
|
||||||
|
const hand = elements.getElementById("hand");
|
||||||
|
|
||||||
|
gsap.set([plant, hand], { autoAlpha: 0 });
|
||||||
|
|
||||||
|
const tl = gsap.timeline({ defaults: { ease: "power3.inOut" } });
|
||||||
|
|
||||||
|
tl.fromTo(hand, { x: "-=300" }, { duration: 1, x: "+=300", autoAlpha: 1 });
|
||||||
|
tl.fromTo(plant, { y: "+=10" }, { duration: 1, y: "-=10", autoAlpha: 1 });
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={wrapper} className="App">
|
||||||
|
<Scene />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user