@Entry
@Component
struct Index {
@State widthA: number = 200
@State heightA: number= 200
@State angleA:number = 0
onPageShow():void{
animateTo ( {
duration: 2000,
iterations: -1,
curve:Curve.Linear
}, () => {
this.widthA = 0
this.heightA = 0
this.angleA = 360
} )
}
build() {
Column() {
// 中心旋转
Column(){}
.width(200)
.height(200)
.backgroundColor('#ffc44f4f')
.rotate({
x: 0,
y: 0,
z: 1,
angle: this.angleA,
centerX:100,
centerY:100,
})
Text('中心旋转')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({bottom:10,top:10})
// 空翻
Column(){}
.width(200)
.height(200)
.backgroundColor('#ffc44f4f')
.rotate({
x: 1,
y: 0,
z: 0,
angle: this.angleA,
centerX:100,
centerY:0,
})
Text('空翻')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({bottom:10,top:10})
// 旋转缩放
Column(){}
.width(this.widthA)
.height(this.heightA)
.backgroundColor('#ffc44f4f')
.rotate({
x: 0,
y: 0,
z: 1,
angle: this.angleA,
centerX:100,
centerY:100,
})
Text('旋转缩放')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({bottom:10,top:10})
}
.width('100%')
.margin({top:40})
}
}
再次感谢您的阅读和支持!
最诚挚的问候, “特创码农”