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_clickable = [] as PromoScene[]
|
||||||
let sidebar_visible = [] as PromoScene[]
|
let sidebar_visible = [] as PromoScene[]
|
||||||
|
|
||||||
const COUNT = 50
|
const COUNT = 30
|
||||||
type smooth = {
|
type smooth = {
|
||||||
value: Vector3 | Quaternion | undefined,
|
value: Vector3 | Quaternion | undefined,
|
||||||
count: number
|
count: number
|
||||||
|
@ -279,28 +279,7 @@ watch(() => sidebar.is_open && sidebar.id_clickable, () => {
|
||||||
target_vector.setComponent(1, targetDistance.min)
|
target_vector.setComponent(1, targetDistance.min)
|
||||||
|
|
||||||
set_moveto(smooth_target, target_vector)
|
set_moveto(smooth_target, target_vector)
|
||||||
|
set_moveto(smooth_move, target_vector.multiply(new Vector3(1.25, 1, 1.25)))
|
||||||
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)
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
|
@ -327,32 +306,33 @@ onBeforeRender(() => {
|
||||||
if (smooth_target.value || smooth_move.value) {
|
if (smooth_target.value || smooth_move.value) {
|
||||||
timer.resetTimer()
|
timer.resetTimer()
|
||||||
home_timer.resetTimer()
|
home_timer.resetTimer()
|
||||||
if (smooth_target.value) {
|
|
||||||
(controls.value as any).target.lerp(smooth_target.value as Vector3, koef);
|
if (smooth_move.value) {
|
||||||
smooth_target.count -= 1
|
camera.value?.position.lerp(smooth_move.value as Vector3, koef);
|
||||||
if (smooth_target.count == 1) {
|
camera.value?.updateMatrixWorld()
|
||||||
set_moveto(smooth_target, undefined)
|
smooth_move.count -= 1
|
||||||
if (temp_smooth_target.value) {
|
if (smooth_move.count == 1) {
|
||||||
set_moveto(smooth_target, temp_smooth_target.value)
|
set_moveto(smooth_move, undefined)
|
||||||
set_moveto(temp_smooth_target, undefined)
|
if (temp_smooth_move.value) {
|
||||||
|
set_moveto(smooth_move, temp_smooth_move.value)
|
||||||
|
set_moveto(temp_smooth_move, undefined)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (smooth_move.value) {
|
if (smooth_target.value) {
|
||||||
camera.value?.position.lerp(smooth_move.value as Vector3, koef);
|
(controls.value as any).target.lerp(smooth_target.value as Vector3, koef);
|
||||||
smooth_move.count -= 1
|
(controls.value as any).update()
|
||||||
if (smooth_move.count == 1) {
|
smooth_target.count -= 1
|
||||||
set_moveto(smooth_move, undefined)
|
if (smooth_target.count == 1) {
|
||||||
if (temp_smooth_move.value) {
|
set_moveto(smooth_target, undefined)
|
||||||
set_moveto(smooth_move, temp_smooth_move.value)
|
if (temp_smooth_target.value) {
|
||||||
set_moveto(temp_smooth_move, undefined)
|
set_moveto(smooth_target, temp_smooth_target.value)
|
||||||
|
set_moveto(temp_smooth_target, undefined)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(controls.value as any).update()
|
|
||||||
camera.value?.updateMatrixWorld()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => targetDistance.min, () => {
|
watch(() => targetDistance.min, () => {
|
||||||
|
|
Loading…
Reference in New Issue