Files
Dwinzo_Demo/app/src/modules/simulation/crane/instances/instance/pillarJibInstance.tsx

51 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-08-07 16:49:14 +05:30
import { useState } from 'react';
2025-08-07 14:53:20 +05:30
import * as THREE from 'three'
2025-08-06 18:19:54 +05:30
import PillarJibAnimator from '../animator/pillarJibAnimator'
2025-08-07 14:53:20 +05:30
import PillarJibHelper from '../helper/pillarJibHelper'
2025-08-06 18:19:54 +05:30
function PillarJibInstance({ crane }: { crane: CraneStatus }) {
2025-08-07 16:49:14 +05:30
const [animationPhase, setAnimationPhase] = useState<string>('idle');
2025-08-06 18:19:54 +05:30
2025-08-07 14:53:20 +05:30
const position1: [number, number, number] = [5, 1, -4];
const position2: [number, number, number] = [-2, 2, -2];
2025-08-07 16:49:14 +05:30
const handleAnimationComplete = (action: string) => {
if (action === 'picking') {
setTimeout(() => {
setAnimationPhase('init-hook-adjust');
}, 3000)
} else if (action === 'dropping') {
setTimeout(() => {
setAnimationPhase('idle');
}, 3000)
}
}
2025-08-06 18:19:54 +05:30
return (
<>
2025-08-07 14:53:20 +05:30
<PillarJibAnimator
2025-08-07 16:49:14 +05:30
key={crane.modelUuid}
2025-08-07 14:53:20 +05:30
crane={crane}
points={[
new THREE.Vector3(...position1),
new THREE.Vector3(...position2)
]}
2025-08-07 16:49:14 +05:30
animationPhase={animationPhase}
setAnimationPhase={setAnimationPhase}
onAnimationComplete={handleAnimationComplete}
2025-08-07 14:53:20 +05:30
/>
{/* <PillarJibHelper
crane={crane}
points={[
new THREE.Vector3(...position1),
new THREE.Vector3(...position2)]
}
/> */}
2025-08-06 18:19:54 +05:30
</>
)
}
2025-08-07 14:53:20 +05:30
export default PillarJibInstance;