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

Is svelte-scenejs on the roadmap? #79

Open
stemcc opened this issue Aug 10, 2022 · 3 comments
Open

Is svelte-scenejs on the roadmap? #79

stemcc opened this issue Aug 10, 2022 · 3 comments
Labels

Comments

@stemcc
Copy link

stemcc commented Aug 10, 2022

I've been enjoying working your svelte-movable library. Would love to know if you've considered a svelte client for scenejs.

@daybrush
Copy link
Owner

@stemcc

I will remake scenejs for all frameworks including svelte. (in hooks or reactive form)

I will release it within this month.

  • Concept
<script>
import { useSceneItem } from "scenejs";


const {
    left, top, transform,
    play,
} = useSceneItem({
   0: {
       left: "0px",
       top: "100px",
       transform: "translate(0px)",
   },
   1: {
       left: "100px",
       top: "100px",
       transform: "translate(100px)",
   },
});


play();
</script>
<div style={{ transform: $transform, left: $left, top: $top }}>
Target
</div>

@stemcc
Copy link
Author

stemcc commented Aug 11, 2022

That's great to hear! Looking forward to it :-)

daybrush added a commit that referenced this issue Dec 15, 2022
@daybrush
Copy link
Owner

@stemcc

svelte-scenejs@1.0.0-beta.1 is released.

https://github.com/daybrush/scenejs/tree/master/packages/svelte-scenejs

$ npm install svelte-scenejs
<script>
import {
    useScene,
    useSceneItem,
    useFrame,
    useNowFrame,
} from "svelte-scenejs";


const scene = new Scene({
    "a1": {
        0: {
            left: "0px",
            top: "0px",
            transform: `translate(0px, 0px)`,
        },
        1: {
            left: "100px",
            top: "100px",
            transform: `translate(100px, 0px)`,
        },
    },
    "a2": {
        0: {
            left: "0px",
            top: "0px",
            transform: `translate(0px, 0px)`,
        },
        1: {
            left: "100px",
            top: "100px",
            transform: `translate(100px, 0px)`,
        },
    }
});
const { cssText: cssText1 } = useNowFrame(scene.getItem("a1"));
const { cssText: cssText2 } = useNowFrame(scene.getItem("a2"));

</script>
<div class="container">
    <div class="a1" style={$cssText1}></div>
    <div class="a2" style={$cssText2}></div>
</div>

There are still many shortcomings and explanations are insufficient.

  1. Tell me if there is something missing or a feature you want.
  2. Or suggest me if there is a better way.

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

No branches or pull requests

2 participants