stagexl 0.13.7 copy "stagexl: ^0.13.7" to clipboard
stagexl: ^0.13.7 copied to clipboard

outdatedDart 1 only

A fast and universal 2D rendering engine for HTML5 and Dart.

example/example.dart

import 'dart:async';
import 'dart:html' as html;
import 'package:stagexl/stagexl.dart';

Future main() async {

  StageXL.stageOptions.renderEngine = RenderEngine.WebGL;
  StageXL.stageOptions.backgroundColor = 0xFF303030;
  StageXL.stageOptions.transparent = true;
  StageXL.bitmapDataLoadOptions.maxPixelRatio = 3;

  // init Stage and RenderLoop

  var canvas = html.querySelector('#stage');
  var stage = new Stage(canvas, width: 400, height: 600);
  var renderLoop = new RenderLoop();
  renderLoop.addStage(stage);

  var shape = new Shape();
  shape.graphics.moveTo(20,20);
  shape.graphics.lineTo(50,70);
  shape.graphics.lineTo(80,60);
  shape.graphics.strokeColor(Color.Red, 20, JointStyle.ROUND);

  var bitmapData = new BitmapData(100,100, Color.Transparent);
  bitmapData.draw(shape);
  var png = bitmapData.toDataUrl();
  print(png);

  // ---------

  var bitmapData2 = await BitmapData.load(png);
  var bitmap = new Bitmap(bitmapData2);
  stage.addChild(bitmap);


}
37
likes
0
pub points
56%
popularity

Publisher

unverified uploader

A fast and universal 2D rendering engine for HTML5 and Dart.

Homepage

Documentation

Documentation

License

unknown (license)

Dependencies

xml

More

Packages that depend on stagexl