import React, { useRef } from 'react'
import { useGLTF } from '@react-three/drei'
import gsap from 'gsap'
import { useGSAP } from '@gsap/react';
export function BeerCan(props) {
const { nodes, materials } = useGLTF('/beercannew.glb')
const canRef = useRef(null)
useGSAP(() => {
let ctx = gsap.context(() => {
gsap.from(canRef.current.position, { y: 10, duration: 1, })
})
return () => ctx.revert()
}, [])
return (
<group ref={canRef} position={[-0.829, 4.1, -4.274]} rotation={[-0.1, 1.35, 0]} scale={[1.11, 2.0, 1.11]}>
<mesh geometry={nodes.Cylinder_1.geometry} material={materials['top of can']} />
<mesh geometry={nodes.Cylinder_2.geometry} material={materials.image} />
</group>
)
}
useGLTF.preload('/beercannew.glb'),once i save it ,it works well,but after i reload my page it takes previous position as initial position