Skip to content

Commit

Permalink
feat: remove auto roll from web version
Browse files Browse the repository at this point in the history
  • Loading branch information
RasenGUY committed Nov 11, 2023
1 parent ef3ac03 commit 943b47a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/Dice/animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function useRoll(diceRef: any,) {
const triggerRoll = () => setStrigger((s: boolean) => !s);

function roll() {
gsap.set("g#all-sides", {y: "0"})
gsap.set("g#all-sides", { y: "0" })
const tl = gsap.timeline();
tl.to("g#all-sides", {
duration: 2,
Expand All @@ -16,9 +16,11 @@ export function useRoll(diceRef: any,) {
})
}
useLayoutEffect(()=> {
const ctx = gsap.context(() => {

const ctx = gsap.context(() => {
roll();
}, diceRef);

return () => ctx.revert();
}, [trigger]);

Expand Down
4 changes: 2 additions & 2 deletions src/components/LandingPageHero/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { useRef } from 'react';
import { PlayGameContainer } from "../LandingPageHeroSection/types";
import { Dice } from "../Dice";
import { useRoll, useAutoRoll } from "../Dice/animations";
import { useRoll } from "../Dice/animations";
import { LeftPlayerCard, RightPlayerCard } from "../LandingHeroPlayerCard";
import Button from "../Button";
import 'twin.macro';

const LandingPageHero = () => {
const diceRef = useRef<any>(null);
const triggerDice = useRoll(diceRef);
useAutoRoll(diceRef);
// useAutoRoll(diceRef);

return (
<PlayGameContainer tw="flex flex-col gap-[21px]">
Expand Down

0 comments on commit 943b47a

Please sign in to comment.