漸層填充示例
for (let i = 0; i < 10; i++) this.addChild(new egret.Shape()).name = `s${i}`;
[[255, 0], [230, 0], [205, 0], [180, 0], [155, 0], [0, 155], [0, 180], [0, 205], [0, 230], [0, 255]].forEach((item, index) => {
let s = this.getChildByName(`s${index}`);
s.graphics.beginGradientFill(egret.GradientType.LINEAR, [0xFF0000, 0x0000FF], [1, 1], item);// ratio 參數測試
s.graphics.drawRect(0, 0, 100, 100);
s.graphics.endFill();
s.y = index * 100;
});
沒有留言:
張貼留言