move
This commit is contained in:
parent
ccf64bfe52
commit
39e56e8663
|
@ -36,7 +36,7 @@ const targetDistance = reactive({ max: 10, min: 0 })
|
|||
let sidebar_clickable = [] as PromoScene[]
|
||||
let sidebar_visible = [] as PromoScene[]
|
||||
|
||||
const COUNT = 50
|
||||
const COUNT = 30
|
||||
type smooth = {
|
||||
value: Vector3 | Quaternion | undefined,
|
||||
count: number
|
||||
|
@ -279,28 +279,7 @@ watch(() => sidebar.is_open && sidebar.id_clickable, () => {
|
|||
target_vector.setComponent(1, targetDistance.min)
|
||||
|
||||
set_moveto(smooth_target, target_vector)
|
||||
|
||||
const lerp_vector = new Vector3(0, 0, 0)
|
||||
lerp_vector.lerpVectors(camera.value?.position, target_vector, 0.5)
|
||||
lerp_vector.setComponent(1, targetDistance.max * 0.5)
|
||||
|
||||
// if (
|
||||
// camera.value?.position
|
||||
// && (
|
||||
// camera.value?.position.distanceTo(lerp_vector) > targetDistance.max * 0.5
|
||||
// || camera.value?.position.distanceTo(target_vector) > raw_dataStore.data.min_distance
|
||||
// )
|
||||
// ) {
|
||||
// set_moveto(smooth_target, lerp_vector)
|
||||
// set_moveto(smooth_move, lerp_vector)
|
||||
|
||||
// set_moveto(temp_smooth_target, target_vector)
|
||||
// set_moveto(temp_smooth_move, target_vector)
|
||||
// } else {
|
||||
set_moveto(smooth_target, target_vector)
|
||||
set_moveto(smooth_move, target_vector)
|
||||
|
||||
// }
|
||||
set_moveto(smooth_move, target_vector.multiply(new Vector3(1.25, 1, 1.25)))
|
||||
}
|
||||
}
|
||||
}, { deep: true })
|
||||
|
@ -327,20 +306,10 @@ onBeforeRender(() => {
|
|||
if (smooth_target.value || smooth_move.value) {
|
||||
timer.resetTimer()
|
||||
home_timer.resetTimer()
|
||||
if (smooth_target.value) {
|
||||
(controls.value as any).target.lerp(smooth_target.value as Vector3, koef);
|
||||
smooth_target.count -= 1
|
||||
if (smooth_target.count == 1) {
|
||||
set_moveto(smooth_target, undefined)
|
||||
if (temp_smooth_target.value) {
|
||||
set_moveto(smooth_target, temp_smooth_target.value)
|
||||
set_moveto(temp_smooth_target, undefined)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (smooth_move.value) {
|
||||
camera.value?.position.lerp(smooth_move.value as Vector3, koef);
|
||||
camera.value?.updateMatrixWorld()
|
||||
smooth_move.count -= 1
|
||||
if (smooth_move.count == 1) {
|
||||
set_moveto(smooth_move, undefined)
|
||||
|
@ -350,9 +319,20 @@ onBeforeRender(() => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (smooth_target.value) {
|
||||
(controls.value as any).target.lerp(smooth_target.value as Vector3, koef);
|
||||
(controls.value as any).update()
|
||||
camera.value?.updateMatrixWorld()
|
||||
smooth_target.count -= 1
|
||||
if (smooth_target.count == 1) {
|
||||
set_moveto(smooth_target, undefined)
|
||||
if (temp_smooth_target.value) {
|
||||
set_moveto(smooth_target, temp_smooth_target.value)
|
||||
set_moveto(temp_smooth_target, undefined)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => targetDistance.min, () => {
|
||||
|
|
Loading…
Reference in New Issue