|
|
@@ -300,38 +300,87 @@ export struct LyricView2 {
|
|
|
}
|
|
|
// 逐字歌词渲染
|
|
|
@Builder
|
|
|
+ WordByWordLyric2(item: LyricLine, index: number) {
|
|
|
+ Column() {
|
|
|
+ // 英文逐字歌词
|
|
|
+ Row({ space: 0 }) {
|
|
|
+ ForEach(item.words, (word: LyricWord, wordIndex: number) => {
|
|
|
+ Text(word.word)
|
|
|
+ .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)
|
|
|
+ .margin({ right: 2 })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
+
|
|
|
+ // 中文翻译(整行显示)
|
|
|
+ if (item.translation) {
|
|
|
+ Text(item.translation)
|
|
|
+ .fontSize(this.textSize)
|
|
|
+ .fontColor(index == this.currentIndex ?
|
|
|
+ this.textHighlightColor : this.textColor)
|
|
|
+ .margin({ top: 4 })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .width(this.alignMode == 'center' ? '100%' : '95%')
|
|
|
+ .opacity(this.calculateOpacityFactor(index, this.currentIndex))
|
|
|
+ }
|
|
|
+ @Builder
|
|
|
WordByWordLyric(item: LyricLine, index: number) {
|
|
|
- Row({ space: 0 }) {
|
|
|
- ForEach(item.words, (word: LyricWord, wordIndex: number) => {
|
|
|
-
|
|
|
-
|
|
|
- Text(this.getTransverterText(word.word))
|
|
|
- .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)
|
|
|
- .margin(0)
|
|
|
- .opacity(this.calculateOpacityFactor(index, this.currentIndex))
|
|
|
- .blur(this.calculateBlurFactor(index, this.currentIndex))
|
|
|
- .visibility(this.isSingleLine?
|
|
|
- (index == this.currentIndex ?Visibility.Visible:Visibility.None)
|
|
|
- :Visibility.Visible)
|
|
|
- .animation({
|
|
|
- // 动画播放速度
|
|
|
- tempo: 0.8,
|
|
|
- // 动画持续时间,单位是毫秒
|
|
|
- duration: 777,
|
|
|
- // 动画缓动函数
|
|
|
- curve: Curve.FastOutSlowIn
|
|
|
- })
|
|
|
- })
|
|
|
+ Column() {
|
|
|
+ Row({ space: 0 }) {
|
|
|
+ ForEach(item.words, (word: LyricWord, wordIndex: number) => {
|
|
|
+
|
|
|
+
|
|
|
+ Text(word.word)
|
|
|
+ .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)
|
|
|
+ .margin({ right: 4 })
|
|
|
+ .opacity(this.calculateOpacityFactor(index, this.currentIndex))
|
|
|
+ .blur(this.calculateBlurFactor(index, this.currentIndex))
|
|
|
+ .visibility(this.isSingleLine?
|
|
|
+ (index == this.currentIndex ?Visibility.Visible:Visibility.None)
|
|
|
+ :Visibility.Visible)
|
|
|
+ .animation({
|
|
|
+ // 动画播放速度
|
|
|
+ tempo: 0.8,
|
|
|
+ // 动画持续时间,单位是毫秒
|
|
|
+ duration: 777,
|
|
|
+ // 动画缓动函数
|
|
|
+ curve: Curve.FastOutSlowIn
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
+ .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '85%')
|
|
|
+
|
|
|
+ // 中文翻译(整行显示)
|
|
|
+ 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 })
|
|
|
+ .opacity(this.calculateOpacityFactor(index, this.currentIndex))
|
|
|
+ .blur(this.calculateBlurFactor(index, this.currentIndex))
|
|
|
+ }
|
|
|
+ .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
+ .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '85%')
|
|
|
+ }
|
|
|
}
|
|
|
- .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
|
|
|
- .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '85%')
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
isTopBottomLine(index:number){
|
|
|
return index === 0 || index === this.listAdapter.totalCount() - 1;
|
|
|
}
|