diff --git a/front/src/components/Promo/load_models.vue b/front/src/components/Promo/load_models.vue index ef787ff..c81ee31 100644 --- a/front/src/components/Promo/load_models.vue +++ b/front/src/components/Promo/load_models.vue @@ -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,32 +306,33 @@ 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) + + 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) + if (temp_smooth_move.value) { + set_moveto(smooth_move, temp_smooth_move.value) + set_moveto(temp_smooth_move, undefined) } } } else - if (smooth_move.value) { - camera.value?.position.lerp(smooth_move.value as Vector3, koef); - smooth_move.count -= 1 - if (smooth_move.count == 1) { - set_moveto(smooth_move, undefined) - if (temp_smooth_move.value) { - set_moveto(smooth_move, temp_smooth_move.value) - set_moveto(temp_smooth_move, undefined) + if (smooth_target.value) { + (controls.value as any).target.lerp(smooth_target.value as Vector3, koef); + (controls.value as any).update() + 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) } } } } - (controls.value as any).update() - camera.value?.updateMatrixWorld() }) watch(() => targetDistance.min, () => {