From 93216af555f308e69230150e242840699ab5f318 Mon Sep 17 00:00:00 2001 From: drgoodcat <60068941+drgoodcat@users.noreply.github.com> Date: Sat, 2 Oct 2021 16:35:46 +0200 Subject: [PATCH] Fixed --- src/components/AnimatedHand/Hand.js | 29 ++++++++++++ src/components/AnimatedHand/reka.svg | 71 ++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/components/AnimatedHand/Hand.js create mode 100644 src/components/AnimatedHand/reka.svg diff --git a/src/components/AnimatedHand/Hand.js b/src/components/AnimatedHand/Hand.js new file mode 100644 index 0000000..aad6175 --- /dev/null +++ b/src/components/AnimatedHand/Hand.js @@ -0,0 +1,29 @@ +import React, { useRef, useEffect } from "react"; +import { ReactComponent as Scene } from "./reka.svg"; +import gsap from "gsap"; + +function HoldingPlant() { + 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 ( +
+ +
+ ); +} + +export default HoldingPlant; diff --git a/src/components/AnimatedHand/reka.svg b/src/components/AnimatedHand/reka.svg new file mode 100644 index 0000000..7a75072 --- /dev/null +++ b/src/components/AnimatedHand/reka.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +