Skip to content

Instantly share code, notes, and snippets.

@juyal-ahmed
Forked from RobinMoretti/paper-canvas.vue
Created November 21, 2023 11:24
Show Gist options
  • Save juyal-ahmed/168bd2b9ad08e0eeca6fb7b2b08a9190 to your computer and use it in GitHub Desktop.
Save juyal-ahmed/168bd2b9ad08e0eeca6fb7b2b08a9190 to your computer and use it in GitHub Desktop.
Simple PaperJs integration in a vuejs 3 component
<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