Skip to content

Flutter

The openbone package is a dart:ffi plugin over the C runtime, compiled with your app, with an OpenBoneWidget that draws, handles touches and plays sound (flutter_soloud). Flutter 3.41+.

Terminal window
flutter pub add openbone
flutter:
assets:
- assets/hero/ # hero.obone and the images it references

Export the project or the runtime data (JSON or Binary) and put it in assets/ with its images.

The Export dialog with JSON selected for the Knight
import 'package:openbone/openbone.dart';
final controller = OpenBoneController();
OpenBoneWidget.asset(
'assets/hero/hero.obone',
controller: controller,
stateMachine: 'main', // or animation: 'walk'
fit: BoxFit.contain,
);
controller.setNumber('speed', 0.8);
controller.setBool('armed', true);
controller.fire('jump');
controller.play('wave', loop: false, track: 1);

Reference: Flutter runtime

OpenBone is MIT licensed and made by UXCentury. The example art, voices and sounds are credited in the repository.