中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
微信扫码分享
@Entry @Component struct Page240126155113078 { @State message: string = 'Hello World'; @State value: number = 0.6 build() { Row() { Column() { Row() { Text(this.message) .fontSize(50) .fontColor(Color.Black) .fontWeight(FontWeight.Bold) .blendMode(BlendMode.DST_IN, BlendApplyType.OFFSCREEN) }.linearGradient({ direction: GradientDirection.Right, colors: [[0xff0000, 0.0], [0xff0000, this.value], [0x000000, this.value], [0x000000, 1.0]] }).blendMode(BlendMode.SRC_OVER, BlendApplyType.OFFSCREEN) .backgroundImageSize({ width: 0, height: 0 }) Button("add").onClick(() => { this.value += 0.01 }) Button("--").onClick(() => { this.value -= 0.01 }) } .width('100%') } .height('100%') } }