|
|
@@ -232,7 +232,6 @@ export struct LyricView2 {
|
|
|
.width('100%')
|
|
|
.height('100%')
|
|
|
.layoutWeight(1)
|
|
|
- .chainAnimation(true)
|
|
|
.scrollBar(BarState.Off)
|
|
|
.fadingEdge(true,{fadingEdgeLength:LengthMetrics.percent(20)})
|
|
|
.edgeEffect(EdgeEffect.Spring)
|
|
|
@@ -322,6 +321,14 @@ export struct LyricView2 {
|
|
|
index == this.currentIndex ? this.textHighlightColor : this.textColor : this.textColor)
|
|
|
.fontWeight(index == this.currentIndex && this.isHighlightBold ? FontWeight.Bold : this.textWeight)
|
|
|
.margin({ top: 4 })
|
|
|
+ .animation({
|
|
|
+ duration: 150,
|
|
|
+ curve: Curve.Linear
|
|
|
+ })
|
|
|
+ .blendMode(
|
|
|
+ index == this.currentIndex ? BlendMode.DST_IN : undefined,
|
|
|
+ index == this.currentIndex ? BlendApplyType.OFFSCREEN : undefined
|
|
|
+ )
|
|
|
}
|
|
|
.justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
.width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '85%')
|
|
|
@@ -346,9 +353,9 @@ export struct LyricView2 {
|
|
|
*/
|
|
|
getLyricItemLinearGradient(item: LyricLine, index: number): [ResourceColor, number][] {
|
|
|
// 只对当前播放行且包含逐字数据的行应用卡拉OK效果
|
|
|
- if (index !== this.currentIndex || !item.hasWords() || item.words.length === 0) {
|
|
|
+ if (index !== this.currentIndex || item.words.length === 0) {
|
|
|
//console.info('heanup', `getLyricItemLinearGradient - 非高亮行或无逐字数据: index=${index}, currentIndex=${this.currentIndex}, hasWords=${item.hasWords()}, wordsCount=${item.words.length}`)
|
|
|
- return [[Color.Transparent, 0.0], [Color.Transparent, 1.0]]
|
|
|
+ return [[Color.White, 0.0], [Color.White, 1.0]]
|
|
|
}
|
|
|
|
|
|
// 计算该行歌词的总时长
|
|
|
@@ -374,13 +381,11 @@ export struct LyricView2 {
|
|
|
|
|
|
value = Math.max(0, Math.min(1, value))
|
|
|
|
|
|
- //console.info('heanup', `getLyricItemLinearGradient - diff=${diff}, value=${value}, textHighlightColor=${this.textHighlightColor}, textColor=${this.textColor}`)
|
|
|
|
|
|
return [[this.textHighlightColor, 0.0],
|
|
|
[this.textHighlightColor, value],
|
|
|
[this.textColor, value],
|
|
|
[this.textColor, 1.0]]
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -394,8 +399,8 @@ export struct LyricView2 {
|
|
|
getWordByWordLyricLyricItemLinearGradient(item: LyricLine, word: LyricWord, index: number): [ResourceColor, number][] {
|
|
|
// 非高亮行或无效数据,返回透明
|
|
|
if (index !== this.currentIndex || !word || !word.word) {
|
|
|
- console.info('heanup', `getWordByWordLyricLyricItemLinearGradient - 非高亮行或无效word: index=${index}, currentIndex=${this.currentIndex}`)
|
|
|
- return [[Color.Transparent, 0.0], [Color.Transparent, 1.0]]
|
|
|
+ //console.info('heanup', `getWordByWordLyricLyricItemLinearGradient - 非高亮行或无效word: index=${index}, currentIndex=${this.currentIndex}`)
|
|
|
+ return [[Color.White, 0.0], [Color.White, 1.0]]
|
|
|
}
|
|
|
|
|
|
// 计算该字的播放进度
|
|
|
@@ -404,7 +409,7 @@ export struct LyricView2 {
|
|
|
|
|
|
// 异常情况处理
|
|
|
if (wordDuration <= 0) {
|
|
|
- console.info('heanup', `getWordByWordLyricLyricItemLinearGradient - word时长<=0: startTime=${word.startTime}, duration=${word.duration}`)
|
|
|
+ //console.info('heanup', `getWordByWordLyricLyricItemLinearGradient - word时长<=0: startTime=${word.startTime}, duration=${word.duration}`)
|
|
|
// 如果时长无效,检查当前播放位置是否已到达开始时间
|
|
|
if (this.currentMediaPosition >= word.startTime) {
|
|
|
// 已开始播放,全部高亮
|
|
|
@@ -452,8 +457,7 @@ export struct LyricView2 {
|
|
|
.fontSize(index == this.currentIndex ?this.textSize*this.controller.getHighlightScale():this.textSize)
|
|
|
.fontColor(this.currentMediaPosition >= word.startTime ?
|
|
|
index == this.currentIndex ? this.textHighlightColor : this.textColor : this.textColor)
|
|
|
- .fontWeight(this.currentMediaPosition >= word.startTime && this.isHighlightBold ?
|
|
|
- index == this.currentIndex? FontWeight.Bold : this.textWeight: this.textWeight)
|
|
|
+ .fontWeight(index == this.currentIndex? FontWeight.Bold : this.textWeight)
|
|
|
.margin(isEnglish(word.word) ?{ right:4 }:{})
|
|
|
.visibility(this.isSingleLine?
|
|
|
(index == this.currentIndex ?Visibility.Visible:Visibility.None)
|
|
|
@@ -482,7 +486,7 @@ export struct LyricView2 {
|
|
|
.fontSize(index == this.currentIndex ?this.textSize*this.controller.getHighlightScale():this.textSize)
|
|
|
.fontColor(this.currentMediaPosition >= item.beginTime ?
|
|
|
index == this.currentIndex ? this.textHighlightColor : this.textColor : this.textColor)
|
|
|
- .fontWeight(index == this.currentIndex && this.isHighlightBold ? FontWeight.Bold : this.textWeight)
|
|
|
+ .fontWeight(index == this.currentIndex? FontWeight.Bold : this.textWeight)
|
|
|
.margin({ top: 4 })
|
|
|
}
|
|
|
.justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
@@ -494,85 +498,6 @@ export struct LyricView2 {
|
|
|
}
|
|
|
|
|
|
|
|
|
- // @Builder
|
|
|
- // Normalyric(item: LyricLine, index: number) {
|
|
|
- // Column() {
|
|
|
- // // 完全复制 LyricList 的实现结构
|
|
|
- // Row({ space: 10 }) {
|
|
|
- // Text(item.text)
|
|
|
- // .maxLines(index == this.currentIndex ? 1 : 2)
|
|
|
- // .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
- // .padding(5)
|
|
|
- // .textAlign(this.alignMode == 'center' ? TextAlign.Center : TextAlign.Start)
|
|
|
- // .fontWeight(index == this.currentIndex && this.isHighlightBold ? FontWeight.Bold : this.textWeight)
|
|
|
- // .width('100%')
|
|
|
- // .fontColor(index == this.currentIndex ? this.textHighlightColor : this.textColor)
|
|
|
- // .fontSize(index == this.currentIndex ? this.textSize * this.controller.getHighlightScale() : this.textSize)
|
|
|
- // .blendMode(
|
|
|
- // index == this.currentIndex ? BlendMode.DST_IN : undefined,
|
|
|
- // index == this.currentIndex ? BlendApplyType.OFFSCREEN : undefined
|
|
|
- // )
|
|
|
- // // 关键:添加线性动画,使渐变平滑过渡
|
|
|
- // .animation({
|
|
|
- // duration: 500,
|
|
|
- // curve: Curve.Linear
|
|
|
- // })
|
|
|
- // }
|
|
|
- // // 在 Row 上应用渐变
|
|
|
- // .linearGradient(index == this.currentIndex ? {
|
|
|
- // direction: GradientDirection.Right,
|
|
|
- // colors: this.getLyricItemLinearGradient(item, index)
|
|
|
- // } : undefined)
|
|
|
- // .blendMode(
|
|
|
- // index == this.currentIndex ? BlendMode.SRC_OVER : undefined,
|
|
|
- // index == this.currentIndex ? BlendApplyType.OFFSCREEN : undefined
|
|
|
- // )
|
|
|
- // .borderRadius(5)
|
|
|
- // .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
- // .width(this.alignMode == 'center' ? '100%' : (index == this.currentIndex ? '95%' : '85%'))
|
|
|
- // .visibility(this.isSingleLine ?
|
|
|
- // (index == this.currentIndex ? Visibility.Visible : Visibility.None)
|
|
|
- // : Visibility.Visible)
|
|
|
- //
|
|
|
- // // 中文翻译(整行显示)
|
|
|
- // if (item.translation) {
|
|
|
- // Row({ space: 0 }) {
|
|
|
- // Text(item.translation)
|
|
|
- // .fontSize(index == this.currentIndex ? this.textSize * this.controller.getHighlightScale() : this.textSize)
|
|
|
- // .fontColor(this.currentMediaPosition >= item.beginTime ?
|
|
|
- // index == this.currentIndex ? this.textHighlightColor : this.textColor : this.textColor)
|
|
|
- // .fontWeight(index == this.currentIndex && this.isHighlightBold ? FontWeight.Bold : this.textWeight)
|
|
|
- // .margin({ top: 4 })
|
|
|
- // .blendMode(
|
|
|
- // index == this.currentIndex ? BlendMode.DST_IN : undefined,
|
|
|
- // index == this.currentIndex ? BlendApplyType.OFFSCREEN : undefined
|
|
|
- // )
|
|
|
- // // 关键:添加线性动画,使渐变平滑过渡
|
|
|
- // .animation({
|
|
|
- // duration: 150,
|
|
|
- // curve: Curve.Linear
|
|
|
- // })
|
|
|
- // }
|
|
|
- // .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
- // .width(this.alignMode == 'center' ? '100%' : (index == this.currentIndex ? '95%' : '85%'))
|
|
|
- // // 在 Row 上应用渐变
|
|
|
- // .linearGradient(index == this.currentIndex ? {
|
|
|
- // direction: GradientDirection.Right,
|
|
|
- // colors: this.getLyricItemLinearGradient(item, index)
|
|
|
- // } : undefined)
|
|
|
- // .blendMode(
|
|
|
- // index == this.currentIndex ? BlendMode.SRC_OVER : undefined,
|
|
|
- // index == this.currentIndex ? BlendApplyType.OFFSCREEN : undefined
|
|
|
- // )
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- isTopBottomLine(index:number){
|
|
|
- return index === 0 || index === this.listAdapter.totalCount() - 1;
|
|
|
- }
|
|
|
//修复get Property index out of bounds
|
|
|
private handleSeekAction() {
|
|
|
clearTimeout(this.seekUiHideTimeout);
|