I have a method that creates planet model with disk, and i want to animate disk (want to rotate it) i listen about three js animation system but i am beginner in three js, and has no idea how can i do that, after research i see about mesh.animations and property but in this case its length is 0 how can i do that with mesh.animations ?
createModel = (planetTexture, diskTexture, options) => {
const {
scaleCoeficientXYZ,
planetPositionX = 0,
planetPositionY = 0,
planetPositionZ = 0,
diskPositionX = 0,
diskPositionY = 0,
diskPositionZ = 0,
diskRotationX = 0,
diskRotationY = 0,
diskRotationZ = 0,
diskScaleX = 1,
diskScaleY = 1,
diskScaleZ = 1,
} = options
const planetGeometry = new THREE.SphereGeometry(100, 500, 500)
const planetMaterial = new THREE.MeshPhongMaterial({map: planetTexture})
const diskGeometry = new THREE.TorusGeometry(160, 10, 30, 200)
const diskMaterial = new THREE.MeshBasicMaterial({map: diskTexture})
const planet = new THREE.Mesh(planetGeometry, planetMaterial)
const disk = new THREE.Mesh(diskGeometry, diskMaterial)
const planetSystem = new THREE.Object3D()
disk.rotateX(diskRotationX)
disk.rotateY(diskRotationY)
disk.rotateZ(diskRotationZ)
disk.scale.setX(diskScaleX)
disk.scale.setY(diskScaleY)
disk.scale.setZ(diskScaleZ)
planet.position.set(0, 0, 0)
disk.position.set(diskPositionX, diskPositionY, diskPositionZ)
planetSystem.position.set(planetPositionX, planetPositionY, planetPositionZ)
planetSystem.scale.set(scaleCoeficientXYZ, scaleCoeficientXYZ, scaleCoeficientXYZ)
planetSystem.add(planet)
planetSystem.add(disk)
return planetSystem
}