0
我以爲我有這段代碼需要繪製一條線,但似乎不是。我能指出我做錯了什麼/沒有做什麼嗎?線條不畫到pixi.dart的畫布
import 'dart:html';
import 'package:pixi/pixi.dart';
class BunnyExample
{
CanvasRenderer renderer = new CanvasRenderer(width: 400, height: 300);
Stage stage = new Stage(new Colour.fromHtml('#ffffff'));
Graphics graph = new Graphics();
BunnyExample()
{
document.body.append(this.renderer.view);
window.requestAnimationFrame(_lineAnim);
}
void _lineAnim(var num)
{
window.requestAnimationFrame(this._lineAnim);
graph
..position = new Point(0, 0)
..pivot = new Point(50, 50)
..lineStyle(1,new Colour(255, 0, 0))
..beginFill(new Colour(255,0,0))
..lineTo(50, 70)
..endFill();
stage.children.add(graph);
renderer.render(stage);
}
}
void main()
{
new BunnyExample();
}
我看到感謝您的建議...所以它不會默認從0,0開始,而是不會打破您的代碼?或者發生了什麼? :/ – 2014-09-30 10:25:18
哦,當我移動到0,0並畫到50,50時,我看不到任何畫......畫布外的原點是什麼? o.O – 2014-09-30 10:38:53
如果刪除'position'和'pivot'屬性,可以從0,0到50,50畫一條線,但我無法向你解釋原因。我不是這個庫的專家,我只是調試你的代碼,找出它爲什麼不工作:) – luizmineo 2014-09-30 11:14:30