-
Notifications
You must be signed in to change notification settings - Fork 16
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
integrate with website builders #13
Comments
Hi @lexoyo, I’m glad you’re liking Mantra! Thanks for the kind words. silex.me seems like a really cool tool/service, and I’d love to see Mantra integrated with it! It should be very doable, though a few modifications might have to be made depending on how you plan to integrate it. Did you have any specific questions on how to do this? |
I did not think a lot about it but the UI could be a button in the elements properties When clicked it would open mantra (iframe? Or I am not sure if it is possible/simple... |
I would imagine that loading and instantiating Mantra directly would be preferable to an const { mantra } = window
mantra.on('rekapi:timelineModified', () => {
// Generates a big string of CSS keyframes
const css = mantra.collectOne(
'cssAnimationString',
mantra.collectOne('cssConfigObject')
)
}) (EDIT: ⬆️ is a little dangerous, please see my next comment!) I don't think you'll have to worry too much about Does this help? |
I experimented with the above snippet a bit more, and I realized that you will probably not want to bind an expensive operation to the You'll probably just want to do this to fetch the generated CSS once your app actually needs it: const css = mantra.collectOne(
'cssAnimationString',
mantra.collectOne('cssConfigObject')
) That's a fairly expensive operation, so you'll want to avoid calling it too often! |
This is useful info thx I suppose there is an easy way to set the current animation? What is the data source like? The json maybe? I'll try to make a first prototype and we will see what is easy and what is not :) |
The fundamental APIs to do what you need are there, though admittedly some of them are not documented particularly well. This function will set the current animation within Mantra: Lines 139 to 169 in 28949b0
You can access it globally, and it accepts Rekapi mantra.loadTimeline({ ... }) You can also retrieve the current timeline data: mantra/scripts/components/rekapi/main.js Lines 153 to 174 in 28949b0
Which can be accessed globally: mantra.rekapiComponent.exportTimeline() These methods deal with the same data format, so something like this would reload the current timeline: mantra.loadTimeline(mantra.rekapiComponent.exportTimeline()) Granted, there's no real reason to reload the current timeline, but this snippet shows how these functions can be used in an interoperable way. Let me know if this clarifies things for you! |
hi @jeremyckahn
i love this tool so far, great idea !
i'm developing a lot on silex these days (silex.me)
i would love to see how we could make mantra help silex users :)
i ask a friend who uses silex to make website what he thinks about mantra to animate elements of his websites
The text was updated successfully, but these errors were encountered: