已给版本

This commit is contained in:
梁泽军 2025-03-04 17:06:09 +08:00
parent e3f8651643
commit 2e5cde7d62

View File

@ -85,7 +85,7 @@ console.log('isLegacyiOS', isLegacyiOS);
// 线 // 线
const progressArr = [0, 38, 48, 67, 100,] const progressArr = [0, 25, 45, 85, 100,]
const playerRef = ref(null) const playerRef = ref(null)
const imageFramePlayer = ref(null) const imageFramePlayer = ref(null)
@ -157,8 +157,8 @@ const playFn = (index) => {
} }
if (locationId.value !== index) { if (locationId.value !== index) {
// //
//
const setpNum = Math.abs(index - locationId.value) const setpNum = Math.abs(index - locationId.value)
const direction = index - locationId.value > 0 ? 1 : -1
console.log('setpNum', setpNum); console.log('setpNum', setpNum);
locationId.value = index; locationId.value = index;
@ -171,7 +171,7 @@ const playFn = (index) => {
} }
] ]
}; };
handleMove(progressArr[index - 1], setpNum) handleMove(progressArr[index - 1], setpNum, direction)
} else { } else {
locationId.value = index locationId.value = index
playerRef.value.source = { playerRef.value.source = {
@ -237,14 +237,21 @@ const initSvgAnimation = () => {
path: "#motionPath", path: "#motionPath",
align: "#motionPath", align: "#motionPath",
autoRotate: false, autoRotate: false,
type: "uniform", //
curviness: 0,
// //
from: convertCoordinates({ x: 0, y: 0 }), from: convertCoordinates({ x: 0, y: 0 }),
to: convertCoordinates({ x: 1, y: 1 }), to: convertCoordinates({ x: 1, y: 1 }),
usePathData: true usePathData: true
}, },
snap: {
x: 1, //
y: 1
},
paused: true, paused: true,
duration: 1, duration: 1,
ease: "power2.inOut" ease: "none",
force3D: true // GPU
}) })
// //
@ -257,7 +264,7 @@ const initSvgAnimation = () => {
} }
// //
const handleMove = (percent, setpNum) => { const handleMove = (percent, setpNum,) => {
const target = percent const target = percent
// //
@ -268,6 +275,7 @@ const handleMove = (percent, setpNum) => {
gsap.to(currentProgress, { gsap.to(currentProgress, {
value: clampedTarget, value: clampedTarget,
duration: 1 * setpNum, duration: 1 * setpNum,
ease: "power2.inOut", //
onUpdate: () => { onUpdate: () => {
animation.progress(currentProgress.value / 100) animation.progress(currentProgress.value / 100)
}, },
@ -290,8 +298,6 @@ const handleMove = (percent, setpNum) => {
// //
const animationFn = () => { const animationFn = () => {
const tl = gsap.timeline({ const tl = gsap.timeline({
onComplete: () => { onComplete: () => {
gsap.to(".title-flower", { gsap.to(".title-flower", {
@ -659,15 +665,21 @@ const animationFn = () => {
.xfl-icon { .xfl-icon {
pointer-events: none; pointer-events: none;
position: absolute; // position: absolute;
width: 163px; width: 163px;
height: 153px; height: 153px;
// 1.5 // 1.5
will-change: transform; will-change: transform;
transform: translate(-50%, -50%) scale(1.5); transform: translateZ(0) translate(-50%, -50%) scale(1.5);
visibility: hidden; visibility: hidden;
/* 旧iOS需要绝对像素值 */
@media screen and (-webkit-min-device-pixel-ratio:0) {
will-change: transform;
transform: translateZ(0) translate(-50%, -50%) scale(1.5);
}
#frameBox { #frameBox {
width: 100%; width: 100%;
height: 100%; height: 100%;