Skip to content

Commit ee7bad1

Browse files
authored
Update animation.tsx
1 parent 5bd25b7 commit ee7bad1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/components/animation.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import React, { useEffect, useRef,useState } from "react";
44
import Matter from "matter-js";
55

66
const MatterSimulation = () => {
7-
const sceneRef = useRef(null); // Ref untuk container canvas
7+
const sceneRef = useRef<HTMLElement>(null); // Ref untuk container canvas
88
const [score, setScore] = useState(0); // State untuk skor
99

1010
useEffect(() => {
11+
if(!sceneRef){return}
1112
// Modul yang diperlukan dari Matter.js
1213
const { Engine, Render, Runner, World, Bodies, Mouse, MouseConstraint, Events } = Matter;
1314

0 commit comments

Comments
 (0)