flame_svg 1.11.3 copy "flame_svg: ^1.11.3" to clipboard
flame_svg: ^1.11.3 copied to clipboard

Package to add SVG rendering support for the Flame game engine

example/lib/main.dart

import 'package:flame/game.dart';
import 'package:flame_svg/flame_svg.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(GameWidget(game: MyGame()));
}

class MyGame extends FlameGame {
  late Svg svgInstance;

  @override
  void render(Canvas canvas) {
    super.render(canvas);
    svgInstance.renderPosition(canvas, Vector2(100, 200), Vector2.all(300));
  }

  @override
  Future<void> onLoad() async {
    await super.onLoad();
    svgInstance = await loadSvg('android.svg');
    final android = SvgComponent(
      svg: svgInstance,
      position: Vector2.all(100),
      size: Vector2.all(100),
    );
    add(android);
  }
}
22
likes
160
points
3.29k
downloads

Publisher

verified publisherflame-engine.org

Weekly Downloads

Package to add SVG rendering support for the Flame game engine

Repository (GitHub)
View/report issues
Contributing

Topics

#flame #svg #vector-graphics

Documentation

API reference

Funding

Consider supporting this project:

opencollective.com
github.com
patreon.com

License

MIT (license)

Dependencies

flame, flutter, flutter_svg

More

Packages that depend on flame_svg