cellular-automata/lib/app_component.dart

30 lines
602 B
Dart
Raw Normal View History

2018-07-07 13:46:40 +00:00
import 'package:angular/angular.dart';
2018-07-07 14:44:27 +00:00
import 'dart:html' as html;
import 'package:rules_of_living/src/App.dart';
2018-07-07 13:46:40 +00:00
@Component(
selector: 'my-app',
)
2018-07-07 14:44:27 +00:00
class AppComponent implements OnInit {
var name = "World";
App engine;
@ViewChild("caCanvas")
html.CanvasElement canvas;
@override
void ngOnInit() {
canvas.context2D.setFillColorRgb(255, 0, 0);
canvas.context2D.fillRect(0, 0, 200, 150);
engine = new App(canvas);
html.window.animationFrame.then(animFrame);
}
void animFrame(num now) {
engine.process(now);
html.window.animationFrame.then(animFrame);
}
2018-07-07 13:46:40 +00:00
}