js
data: {
animationData: {}
},
onLoad: function (options) {
setTimeout(() => {
var animation = wx.createAnimation({
duration: 1500,
timingFunction: 'ease',
})
this.animation = animation
animation.rotate(180).step()
this.setData({
animationData:animation.export()
})
}, 1000);
},
在wxml
<view class="circle-wrap">
<view class="circle">
<view class="mask full">
<view class="fill"></view>
</view>
<view class="mask half">
<view class="fill" animation="{{animationData}}"></view>
</view>
<view class="inside-circle"> 70% </view>
</view>
</view>
在wxss
/*圓形css進度條*/
.circle-wrap {
margin: 50px auto;
width: 150px;
height: 150px;
background: #e6e2e7;
border-radius: 50%;
}
.circle-wrap .circle .mask,
.circle-wrap .circle .fill {
width: 150px;
height: 150px;
position: absolute;
border-radius: 50%;
}
.circle-wrap .circle .mask {
clip: rect(0px, 150px, 150px, 75px);
}
.circle-wrap .circle .mask .fill {
clip: rect(0px, 75px, 150px, 0px);
background-color: #9e00b1;
}
.circle-wrap .inside-circle {
width: 130px;
height: 130px;
border-radius: 50%;
background: #fff;
line-height: 130px;
text-align: center;
margin-top: 10px;
margin-left: 10px;
position: absolute;
z-index: 100;
font-weight: 700;
font-size: 2em;
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。