12345678910111213141516171819202122232425262728293031323334 |
- <template>
- <canvas id="drawLine1" width="800" height="100" />
- </template>
- <script lang="ts">
- import { SCanvasView, SColor, SPainter } from "@saga-web/draw/lib";
- class TestView extends SCanvasView {
- constructor() {
- super("drawLine1")
- }
- onDraw(canvas: SPainter): void {
- // 清除画布
- canvas.clearRect(0,0,800,100);
- // 在此编写绘制操作相关命令
- canvas.drawLine(0,0, 100, 100);
- canvas.pen.lineWidth = 1;
- canvas.pen.dashOffset = new Date().getTime()/50%60;
- canvas.pen.lineDash = [10,50];
- canvas.drawLine(200, 50, 400, 50);
- this.update();
- }
- }
- export default {
- mounted() {
- new TestView();
- }
- }
- </script>
|