#設(shè)置屏幕顏色
Screen.backgroundColor="white"
#新建layerA層級(jí)
layerA=new Layer
x: Align.center
y: Align.center
width: 300
height: 300
backgroundColor: "pink"
#layerb是文字圖層
layerB=new Layer
y: 567
x: 275
backgroundColor: "null"
html: 1
style:
textAlign:"center"
fontSize:"90px"
lineHeight:"180px"
#新建layerA的狀態(tài),使他旋轉(zhuǎn)360度蹄咖,并且圓角增大至150(變成圓形)
layerA.states.add
change:
rotation:360
borderRadius: 150
#設(shè)置layerA的狀態(tài)變化動(dòng)畫肛响,時(shí)間
layerA.states.animationOptions=
repeat: 1
curve: "ease-in-out"
time: 7
#layerA的狀態(tài)切換
layerA.states.switch("change")
#監(jiān)聽layerA的旋轉(zhuǎn)铆农,并將0-360°轉(zhuǎn)化為1-100
layerA.on "change:rotation",->
percentage=Utils.modulate layerA.rotation,[0,360],[0,100]
layerB.html=(Utils.round percentage,0)+"%"