chore(弹幕组件): 调整速度计算
This commit is contained in:
parent
dd0b0028b8
commit
4a519eb4fa
@ -124,11 +124,6 @@ const props = defineProps({
|
|||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
|
||||||
speed: {
|
|
||||||
type: Number,
|
|
||||||
default: 80, // 基础速度系数
|
|
||||||
},
|
|
||||||
|
|
||||||
maxItems: {
|
maxItems: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 4, // 每行最大弹幕数
|
default: 4, // 每行最大弹幕数
|
||||||
@ -178,7 +173,7 @@ const getBarrageStyle = (item) => {
|
|||||||
const generateBarrageProps = (item) => {
|
const generateBarrageProps = (item) => {
|
||||||
const textLength = item.content.length
|
const textLength = item.content.length
|
||||||
return {
|
return {
|
||||||
duration: Math.min(5 + textLength * 0.1, 8) * (100 / props.speed), // 弹幕项持续时间(每字符增加0.2秒,持续时间不低于8秒)
|
duration: Math.min(5 + textLength * 0.1, 8), // 弹幕项持续时间(每字符增加0.2秒,持续时间不低于8秒)
|
||||||
startPos: 0, // 弹幕项起始位置
|
startPos: 0, // 弹幕项起始位置
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user