restructure embedded animations to allow simultaneous play
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9fb09944d65a155fc5b6522f296dd875df02fc2944733a35eb09bec23bbabdcd
|
||||
size 813192
|
||||
oid sha256:4a3a6b8b48db5d5e71ecd774629cfea00bcd75d4cf1462cb58448e1825c89815
|
||||
size 813688
|
||||
|
||||
@@ -21,6 +21,7 @@ class _MyAppState extends State<MyApp> {
|
||||
|
||||
final weights = List.filled(255, 0.0);
|
||||
List<String> _targets = [];
|
||||
List<String> _animationNames = [];
|
||||
bool _loop = false;
|
||||
|
||||
@override
|
||||
@@ -69,11 +70,13 @@ class _MyAppState extends State<MyApp> {
|
||||
}),
|
||||
ElevatedButton(
|
||||
child: const Text('load cube GLB'),
|
||||
onPressed:_cube != null ? null : () async {
|
||||
onPressed:() async {
|
||||
_cube = await _filamentController
|
||||
.loadGlb('assets/cube.glb');
|
||||
print(await _filamentController
|
||||
.getAnimationNames(_cube!));
|
||||
|
||||
_animationNames =
|
||||
await _filamentController
|
||||
.getAnimationNames(_cube!);
|
||||
}),
|
||||
ElevatedButton(
|
||||
child: const Text('load cube GLTF'),
|
||||
@@ -111,8 +114,12 @@ class _MyAppState extends State<MyApp> {
|
||||
.applyWeights(_cube!, List.filled(8, 0));
|
||||
}),
|
||||
ElevatedButton(
|
||||
onPressed: () =>
|
||||
_filamentController.playAnimation(_cube!, 0, loop: _loop),
|
||||
onPressed: () {
|
||||
_animationNames.asMap().forEach((idx, element) {
|
||||
_filamentController.playAnimation(_cube!, idx, loop: _loop);
|
||||
});
|
||||
|
||||
},
|
||||
child: const Text('play animation')),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
|
||||
Reference in New Issue
Block a user