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

Framework-agnostic Core #10

Open
antfu opened this issue Mar 8, 2024 · 3 comments
Open

Framework-agnostic Core #10

antfu opened this issue Mar 8, 2024 · 3 comments

Comments

@antfu
Copy link

antfu commented Mar 8, 2024

First of all, I love the visuals, thanks for making it!

I come from Vue community and would love to use them in as Vue components like Slidev.

I scanned through the code, and it seems most of the components are WebGL on a single DOM element - which doesn't have to be React-specific. I wonder if you are interested in refactoring them out as a framework-agnostic version, for example:

// Name and interface can be discussed
export function createOpulentoCanvas(options) {
    const renderer = new Renderer();
    const gl = renderer.gl;
    gl.clearColor(1, 1, 1, 1);

    // ...

    return gl.canvas
}

And expose the core and framework wrappers as sub-modules like:

// Agnostic core
import { createOpulentoCanvas } from 'uvcanvas'

// React component (same as current)
import { Opulento } from 'uvcanvas/react'

// Potentially other framework wrappers like:
import { Opulento } from 'uvcanvas/vue'

If that end up happening, I'd be happy to contribute the Vue wrappers :)

Thanks

@ciaochaos
Copy link
Member

Thank you Anthony!

I think your proposal is very reasonable, and I will try to break down the core logic as soon as possible.

Btw, Slidev and the new Shiki Magic Move are awesome, lots of inspiration!

@m0ksem
Copy link

m0ksem commented Mar 26, 2024

I was working on wrapper for 2d frag shaders backgrounds for vue. You can take inspiration from here: https://github.com/m0ksem/vue-glsl.

@CPunisher
Copy link
Contributor

I was working on wrapper for 2d frag shaders backgrounds for vue. You can take inspiration from here: https://github.com/m0ksem/vue-glsl.

Thanks for your support! We're in the process of refactoring a new version on the v1 branch. Any references and help are welcome!

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

4 participants