回复
#星计划# HarmonyOS 鸿蒙 ArkTS 模仿雷达动画效果 原创
特创码农
发布于 2024-1-17 12:49
浏览
0收藏
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
@State qidong: boolean = false
@State num: number = 0
onPageShow (): void {
this.qidong = true
console.log ( '页面触发', this.qidong )
animateTo ( {
duration: 2000,
iterations: -1,
curve:Curve.Linear
}, () => {
this.num = 360
} )
}
build () {
Row () {
Stack ( { alignContent: Alignment.Center } ) { //重叠居中
//最外层的圈
Column () {}
.width ( 150 )
.height ( 150 )
.backgroundColor ( 'rgba(0,0,0,0)' )
.opacity ( 0.1 ) //透明
.borderRadius ( 100 ) //圆角
.shadow ( { radius: 50, color: '#000000' } ) //阴影
.border ( { width: 1, color: '#ffffff', style: BorderStyle.Dashed } ) //边框
.zIndex ( 1 )
//中间的圈
Column () {}
.width ( 100 )
.height ( 100 )
.linearGradient (
{
angle: 180,
colors: [['rgba(0,0,0,0.25)', 0.1], ["rgba(0,0,0,0.25)", 0.6]]
} )
.opacity ( 0.1 )
.border ( { width: 1, color: '#c0dbe0', style: BorderStyle.Solid } ) //边框
.borderRadius ( 100 ) //圆角
.zIndex ( 2 )
//最里面的圈
Column () {}
.width ( 50 )
.height ( 50 )
.opacity ( 0.1 )
.linearGradient ( //渐变色
{
angle: 180,
colors: [['rgba(0,0,0,0.25)', 0.1], ["rgba(0,0,0,0.25)", 0.6]]
} )
.border ( { width: 1, color: '#c0dbe0', style: BorderStyle.Solid } ) //边框
.borderRadius ( 100 ) //圆角
.zIndex ( 5 )
//旋转光
Column(){}
.width ( 70 )
.height ( 70 )
.margin ( { bottom: 70,left:70 } )
.borderRadius({topRight:70})
.shadow ( { radius:150, color: '#2e8b57'} ) //阴影
.backgroundColor('#2e8b57')
.opacity ( 0.7 ) //透明
.zIndex ( 7 )
.rotate ( {
x: 0,
y: 0,
z: 1,
angle: this.num,
centerX:0,
centerY:70,
} )
}
.height ( '100%' )
.width ( '100%' )
.backgroundColor ( '#212121' )
}
}
}
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
赞
收藏
回复
相关推荐