-
-
Save juyal-ahmed/168bd2b9ad08e0eeca6fb7b2b08a9190 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