[code]import Sprite = Laya.Sprite
export default class Test extends Sprite{
public DEF_SIZE: number = 200
public CIRCLE_WIDTH: number = 20
public $circleSprite: Sprite = new Sprite()
public startY: number = -90
constructor() {
super()
this._init()
}
private _init() {
this.cacheAs = "bitmap"
this.size(this.DEF_SIZE,this.DEF_SIZE)
this.pos(200,200)
this.cacheAs = "bitmap"
this.graphics.drawPie(this.DEF_SIZE >> 1, this.DEF_SIZE >> 1, this.DEF_SIZE >> 1,-90,this.startY,'#ff0000')
this.$circleSprite.blendMode = "destination-out"
this.$circleSprite.pos(this.CIRCLE_WIDTH >> 1,this.CIRCLE_WIDTH >> 1)
this.$circleSprite.graphics.clear()
this.$circleSprite.graphics.drawCircle((this.DEF_SIZE - this.CIRCLE_WIDTH) >> 1, (this.DEF_SIZE - this.CIRCLE_WIDTH) >> 1, (this.DEF_SIZE - 20) >> 1, "#fff")
this.addChild(this.$circleSprite)
this.start()
}
public start() {
this.timerLoop(2, this, this.draw)
}
public draw() {
if (this.startY >= 270) {
this.clearTimer(this, this.draw)
}
this.startY++
this.graphics.clear()
this.graphics.drawPie(this.DEF_SIZE >> 1, this.DEF_SIZE >> 1, this.DEF_SIZE >> 1,-90,this.startY,'#ff0000')
}
}
Laya.stage.addChild(new Test())[/code]