Skip to content

Commit

Permalink
fix: remove unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
Romaixn committed Aug 7, 2023
1 parent 4922ecf commit df60148
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Components/Confetti.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Based on: https://github.com/JamesChan21/threejs-confetti
// Based on: https://github.com/daniel-lundin/dom-confetti

import React, { useRef, useState, useEffect } from 'react'
import React, { useRef, useState } from 'react'
import { useFrame } from '@react-three/fiber'
import * as THREE from 'three'

Expand Down Expand Up @@ -94,40 +94,40 @@ export default function ExplosionConfetti(

useFrame(() => {
if (isExploding && Math.random() < rate) explode()

let particleAmount = 0

for (let i = 0; i < booms.length; i++) {
const boom = booms[i]

for (let k = 0; k < boom.children.length; k++) {
let particle = boom.children[k]

particle.destination.y -= THREE.MathUtils.randFloat(0.1, 0.3)
particle.life -= THREE.MathUtils.randFloat(0.005, 0.01)

const speedX = (particle.destination.x - particle.position.x) / 200
const speedY = (particle.destination.y - particle.position.y) / 200
const speedZ = (particle.destination.z - particle.position.z) / 200

particle.position.x += speedX
particle.position.y += speedY
particle.position.z += speedZ

particle.rotation.y += particle.rotateSpeedY
particle.rotation.x += particle.rotateSpeedX
particle.rotation.z += particle.rotateSpeedZ

particle.material.opacity -= THREE.MathUtils.randFloat(0.005, 0.01)

if (particle.position.y < -fallingHeight) {
particle.material.dispose()
particle.geometry.dispose()
boom.remove(particle)
particle = null
}
}

if (boom.children.length <= 0) {
boom.dispose()
setBooms(booms.filter((b) => b !== boom))
Expand All @@ -137,4 +137,4 @@ export default function ExplosionConfetti(
})

return <mesh ref={groupRef} position={[0, 2, -8]} />
}
}

1 comment on commit df60148

@vercel
Copy link

@vercel vercel bot commented on df60148 Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.