Vue Integration
Example component
Section titled “Example component”<template> <div id="app"> <div>Headbreaker from Vue</div> <div id="puzzle"></div> </div></template>
<script setup lang="ts">import { Canvas, painters } from 'headbreaker-ts';import { onMounted } from 'vue';
onMounted(() => { const autogen = new Canvas('puzzle', { width: 800, height: 650, pieceSize: 100, proximity: 20, borderFill: 10, strokeWidth: 2, lineSoftness: 0.18, painter: new painters.Konva(), });
autogen.autogenerate({ horizontalPiecesCount: 2, verticalPiecesCount: 2, metadata: [ { color: '#B83361' }, { color: '#B87D32' }, { color: '#A4C234' }, { color: '#37AB8C' }, ], });
autogen.draw();});</script>