词云修改

This commit is contained in:
duanhao 2025-08-14 15:18:34 +08:00
parent 9667e9cef6
commit 1f2ccfc4ff
4 changed files with 76 additions and 21 deletions

View File

@ -43,6 +43,8 @@ const scanAngle = ref(0)
const scanTimer = ref(null)
const containerWidth = 350
const containerHeight = 276
//
const hasCompletedFirstCycle = ref(false)
const words = ref(props.wordsCloudList)
@ -80,17 +82,31 @@ const startScan = () => {
const progress = (elapsedTime / duration) % 1
const newScanAngle = progress * 360
//
if (newScanAngle < scanAngle.value) {
words.value.forEach((w) => (w.visible = false))
startTime = timestamp
if (!hasCompletedFirstCycle.value) {
//
hasCompletedFirstCycle.value = true
} else {
//
// startTime
startTime = timestamp
}
}
scanAngle.value = newScanAngle
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
//
if (hasCompletedFirstCycle.value) {
words.value.forEach((word) => {
word.visible = true
}
})
})
} else {
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
word.visible = true
}
})
}
scanTimer.value = requestAnimationFrame(animate)
}

View File

@ -44,6 +44,7 @@ const scanAngle = ref(0)
const scanTimer = ref(null)
const containerWidth = 370
const containerHeight = 257
const hasCompletedFirstCycle = ref(false) //
const words = ref(props.wordsCloudList)
@ -82,16 +83,28 @@ const startScan = () => {
const newScanAngle = progress * 360
if (newScanAngle < scanAngle.value) {
words.value.forEach((w) => (w.visible = false))
//
if (!hasCompletedFirstCycle.value) {
words.value.forEach((w) => (w.visible = false))
hasCompletedFirstCycle.value = true //
}
startTime = timestamp
}
scanAngle.value = newScanAngle
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
//
if (!hasCompletedFirstCycle.value) {
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
word.visible = true
}
})
} else {
//
words.value.forEach((word) => {
word.visible = true
}
})
})
}
scanTimer.value = requestAnimationFrame(animate)
}

View File

@ -44,6 +44,7 @@ const scanAngle = ref(0)
const scanTimer = ref(null)
const containerWidth = 370
const containerHeight = 276
const hasCompletedFirstCycle = ref(false) //
const words = ref(props.wordsCloudList)
@ -82,16 +83,28 @@ const startScan = () => {
const newScanAngle = progress * 360
if (newScanAngle < scanAngle.value) {
words.value.forEach((w) => (w.visible = false))
//
if (!hasCompletedFirstCycle.value) {
words.value.forEach((w) => (w.visible = false))
hasCompletedFirstCycle.value = true //
}
startTime = timestamp
}
scanAngle.value = newScanAngle
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
//
if (!hasCompletedFirstCycle.value) {
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
word.visible = true
}
})
} else {
//
words.value.forEach((word) => {
word.visible = true
}
})
})
}
scanTimer.value = requestAnimationFrame(animate)
}

View File

@ -44,6 +44,7 @@ const scanAngle = ref(0)
const scanTimer = ref(null)
const containerWidth = 370
const containerHeight = 276
const hasCompletedFirstCycle = ref(false) //
const words = ref(props.wordsCloudList)
@ -82,16 +83,28 @@ const startScan = () => {
const newScanAngle = progress * 360
if (newScanAngle < scanAngle.value) {
words.value.forEach((w) => (w.visible = false))
//
if (!hasCompletedFirstCycle.value) {
words.value.forEach((w) => (w.visible = false))
hasCompletedFirstCycle.value = true //
}
startTime = timestamp
}
scanAngle.value = newScanAngle
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
//
if (!hasCompletedFirstCycle.value) {
words.value.forEach((word) => {
if (!word.visible && scanAngle.value >= word.angle) {
word.visible = true
}
})
} else {
//
words.value.forEach((word) => {
word.visible = true
}
})
})
}
scanTimer.value = requestAnimationFrame(animate)
}