Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swapping layers/nodes programmatically #125

Open
stx opened this issue Jul 12, 2019 · 5 comments
Open

Swapping layers/nodes programmatically #125

stx opened this issue Jul 12, 2019 · 5 comments

Comments

@stx
Copy link

stx commented Jul 12, 2019

Hi there,

Thanks for your work on this wonderful project. We have a use case I'm not sure if we can implement. If we can, great! If not, this is certainly my feature request.

Think of a character that can wear different hats. We have a Flare actor, with a set of animations, with one layer group/node (the hat) that we want to switch out as needed (with different hats). So we want to do the animations once, with one hat, but be able to swap them later.

Digging through all of the methods exposed, I smell that this might be possible with the artboard. Any insights you can share?

@stx stx changed the title Swapping layers programmatically Swapping layers/nodes programmatically Jul 12, 2019
@luigi-rosso
Copy link
Contributor

We're working on some experimental new features that will allow embedding an artboard from one file into another. It's not going to be available for a bit as there are quite a few edge cases, but we've already made good progress on it!

The feature evolved from an early prototype we tested: https://twitter.com/luigirosso/status/1112561442715099136

This is doing most of the work in Flutter code by using a custom version of the Actor (representation of a Flare file at runtime) and Artboard (representation of an artboard within an Actor). We're working on a generalized solution that is more elegant with actual sortable layers.

In the meantime I could share the code for that example if you'd find it useful? It has some shortcomings and oddities which I wanted to call out in a blog post but never got around to it!

@stx
Copy link
Author

stx commented Jul 13, 2019

Yeah, the Twitter clip is basically exactly what I’m looking for. Would love to see the code for that. Thank you!

@luigi-rosso
Copy link
Contributor

I wanted to do a blog article/writeup explaining what's going on a little before making it public, but because I haven't been able to find the time...here it is!
https://github.com/2d-inc/flutter_dummy_with_hat

Important stuff here:
https://github.com/2d-inc/flutter_dummy_with_hat/blob/master/lib/mountable_actor.dart
https://github.com/2d-inc/flutter_dummy_with_hat/blob/master/lib/mounted_gear.dart

@stx
Copy link
Author

stx commented Aug 17, 2019

@luigi-rosso Thanks for that. I was able to mess with your example and get it working in our case but forgot to respond.

This is super neat. Definitely could use some polish on the interface for it but there's something powerful here.

@luigi-rosso
Copy link
Contributor

Awesome, glad you were able to figure it out!

Glad you find it powerful. We have some ideas for how to get the process working smoothly directly in Flare. We're not quite ready to share anything about it yet, but it's already in the works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants