Skip to content

Commit 902e64a

Browse files
committed
登录页面3.4
1 parent d3a370b commit 902e64a

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

yunyu-web/app/pages/login.vue

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,26 @@ function eyesShiftStyle(vector: { x: number, y: number }, baseX: number, baseY:
181181
}
182182
}
183183
184+
/**
185+
* 计算单只眼球的细微位移。
186+
* 作用:让左右眼在同方向跟随时保留轻微错位,避免两只眼睛永远像镜像复制,
187+
* 更贴近参考页里“眼白位置也在变化”的灵动感。
188+
*
189+
* @param vector 当前角色使用的观察向量
190+
* @param strength 位移强度
191+
* @param side 眼睛方向
192+
* @return 单只眼球位移样式
193+
*/
194+
function eyeballStyle(vector: { x: number, y: number }, strength: number, side: 'left' | 'right') {
195+
const sideOffset = side === 'left' ? -0.8 : 0.8
196+
const x = clamp(vector.x * strength + sideOffset + vector.y * 0.3, -7, 7)
197+
const y = clamp(vector.y * (strength * 0.72) + (side === 'left' ? -0.22 : 0.22), -5, 5)
198+
199+
return {
200+
transform: `translate(${x.toFixed(2)}px, ${y.toFixed(2)}px)`
201+
}
202+
}
203+
184204
/**
185205
* 计算左侧紫色角色的主体姿态。
186206
*
@@ -714,21 +734,21 @@ async function handleSubmit() {
714734
<div class="auth-scene__stage">
715735
<div class="auth-character auth-character--purple" :style="purpleCharacterStyle">
716736
<div class="auth-eyes auth-eyes--white" :class="{ 'shake-head': sceneErrorStage === 'shake' }" :style="eyesShiftStyle(purpleSceneVector, isPasswordFocused && !isShowingPassword ? -14 : isShowingPassword && purplePeeking && purplePeekPhase === 'forward' ? 14 : isShowingPassword && purplePeeking && purplePeekPhase === 'return' ? -10 : isIdentityFocused ? 10 : 0, isPasswordFocused && !isShowingPassword ? -12 : isShowingPassword && purplePeeking && purplePeekPhase === 'forward' ? 9 : isShowingPassword && purplePeeking && purplePeekPhase === 'return' ? -5 : isIdentityFocused ? 8 : 0, 5.8, 4.1)">
717-
<div class="auth-eyeball" :class="{ 'auth-eyeball--blink': purpleBlinking }">
737+
<div class="auth-eyeball" :class="{ 'auth-eyeball--blink': purpleBlinking }" :style="eyeballStyle(purpleSceneVector, isPasswordFocused && !isShowingPassword ? 1.1 : isShowingPassword && purplePeeking && purplePeekPhase === 'forward' ? 1.4 : isShowingPassword ? 1 : 1.45, 'left')">
718738
<div class="auth-pupil" :style="pupilStyle(purpleSceneVector, isPasswordFocused && !isShowingPassword ? 2.4 : isShowingPassword && purplePeeking && purplePeekPhase === 'forward' ? 4 : isShowingPassword && purplePeekPhase === 'return' ? 2.8 : isShowingPassword ? 3.2 : 4.7)" />
719739
</div>
720-
<div class="auth-eyeball" :class="{ 'auth-eyeball--blink': purpleBlinking }">
740+
<div class="auth-eyeball" :class="{ 'auth-eyeball--blink': purpleBlinking }" :style="eyeballStyle(purpleSceneVector, isPasswordFocused && !isShowingPassword ? 1.1 : isShowingPassword && purplePeeking && purplePeekPhase === 'forward' ? 1.4 : isShowingPassword ? 1 : 1.45, 'right')">
721741
<div class="auth-pupil" :style="pupilStyle(purpleSceneVector, isPasswordFocused && !isShowingPassword ? 2.4 : isShowingPassword && purplePeeking && purplePeekPhase === 'forward' ? 4 : isShowingPassword && purplePeekPhase === 'return' ? 2.8 : isShowingPassword ? 3.2 : 4.7)" />
722742
</div>
723743
</div>
724744
</div>
725745

726746
<div class="auth-character auth-character--ink" :style="inkCharacterStyle">
727747
<div class="auth-eyes auth-eyes--white" :class="{ 'shake-head': sceneErrorStage === 'shake' }" :style="eyesShiftStyle(inkSceneVector, isPasswordFocused && !isShowingPassword ? -10 : isIdentityFocused ? 6 : 0, isPasswordFocused && !isShowingPassword ? -11 : isIdentityFocused ? -7 : 0, 4.3, 3.5)">
728-
<div class="auth-eyeball auth-eyeball--small" :class="{ 'auth-eyeball--blink': blackBlinking }">
748+
<div class="auth-eyeball auth-eyeball--small" :class="{ 'auth-eyeball--blink': blackBlinking }" :style="eyeballStyle(inkSceneVector, isPasswordFocused && !isShowingPassword ? 1 : isShowingPassword ? 0.9 : 1.2, 'left')">
729749
<div class="auth-pupil auth-pupil--small" :style="pupilStyle(inkSceneVector, isPasswordFocused && !isShowingPassword ? 2.3 : isShowingPassword ? 2.8 : 3.7)" />
730750
</div>
731-
<div class="auth-eyeball auth-eyeball--small" :class="{ 'auth-eyeball--blink': blackBlinking }">
751+
<div class="auth-eyeball auth-eyeball--small" :class="{ 'auth-eyeball--blink': blackBlinking }" :style="eyeballStyle(inkSceneVector, isPasswordFocused && !isShowingPassword ? 1 : isShowingPassword ? 0.9 : 1.2, 'right')">
732752
<div class="auth-pupil auth-pupil--small" :style="pupilStyle(inkSceneVector, isPasswordFocused && !isShowingPassword ? 2.3 : isShowingPassword ? 2.8 : 3.7)" />
733753
</div>
734754
</div>
@@ -1041,7 +1061,7 @@ async function handleSubmit() {
10411061
overflow: hidden;
10421062
border-radius: 999px;
10431063
background: white;
1044-
transition: height 0.15s ease;
1064+
transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), height 0.15s ease;
10451065
}
10461066
10471067
.auth-eyeball--small {

0 commit comments

Comments
 (0)