Last active
January 22, 2024 13:07
-
-
Save RobinMoretti/b8c81dac7cc45336d6b04b4980509493 to your computer and use it in GitHub Desktop.
Simple PaperJs integration in a vuejs 3 component
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 setup> | |
import paper from "paper" | |
import { ref, onMounted } from 'vue' | |
const canvas = ref(null) | |
onMounted(()=>{ | |
paper.setup(canvas.value); | |
var path = new paper.Path(); | |
path.strokeColor = 'black'; | |
var start = new paper.Point(100, 100); | |
path.moveTo(start); | |
path.lineTo(start.add([ 200, -50 ])); | |
paper.view.draw(); | |
}) | |
</script> | |
<template> | |
<main> | |
<canvas id="paper-canvas" ref="canvas" resize></canvas> | |
</main> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment