HelloWorld.vue 674 B

12345678910111213141516171819202122232425262728293031323334
  1. <script setup lang="ts">
  2. import { onMounted, ref } from "vue";
  3. import { Matrix3 } from "../lmm/math/Matrix3";
  4. defineProps({
  5. size: {
  6. type: Object,
  7. default: {
  8. width: 1000,
  9. height: 500,
  10. },
  11. },
  12. });
  13. const canvasRef = ref<HTMLCanvasElement>();
  14. const m = new Matrix3();
  15. m.elements = [2, 0, 0, 0, 2, 0, 2, 2, 1];
  16. console.log(m.determinant());
  17. console.log(m.invert().determinant());
  18. onMounted(() => {
  19. const canvas = canvasRef.value;
  20. const ctx = canvas?.getContext("2d");
  21. ctx?.fillRect(100, 100, 200, 100);
  22. });
  23. </script>
  24. <template>
  25. <canvas ref="canvasRef" :width="size.width" :height="size.height"></canvas>
  26. </template>
  27. <style scoped></style>