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