Last active
March 20, 2022 07:52
-
-
Save williamngan/d18e4a6d9fc2fbd19e6907561b908a88 to your computer and use it in GitHub Desktop.
This is a quick test of Pts (https://ptsjs.org) with Svelte (https://svelte.dev)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/* This is a quick test of Pts (https://ptsjs.org) with Svelte (https://svelte.dev) */ | |
import { onMount } from "svelte"; | |
import { CanvasSpace, Rectangle } from "pts"; | |
let container, space, form; | |
onMount(() => { | |
space = new CanvasSpace(container).setup({bgcolor: "#52f"}); | |
form = space.getForm(); | |
space.add( time => { | |
form.fillOnly("#f06").point(space.pointer, 200, "circle"); | |
form.strokeOnly("#fff", 5).lines( | |
Rectangle.corners(space.innerBound).map(r => [r, space.pointer]) | |
); | |
form.fillOnly("#0c9").point(space.pointer, 100, "circle"); | |
}); | |
space.bindMouse().bindTouch().play(); | |
}); | |
</script> | |
<style> | |
#pts { width: 100%; height: 100%; } | |
</style> | |
<div id="pts" bind:this={container} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure why the tab-spacing are displayed incorrectly here.