This commit is contained in:
2023-09-19 16:11:52 +08:00
parent a531505bf7
commit 65f06341f2
8 changed files with 98 additions and 17 deletions

View File

@@ -9,6 +9,7 @@
export default {
data () {
return {
af: undefined,
// points: [{x1: 650, y1: 885, x2: 650, y2: 852}, {x1: 577, y1: 815, x2: 548, y2: 815}, {x1: 719, y1: 815, x2: 754, y2: 815}, {x1: 305, y1: 560, x2: 305, y2: 545}, {x1: 419, y1: 510, x2: 419, y2: 490}, {x1: 455, y1: 282, x2: 548, y2: 282}, {x1: 830, y1: 395, x2: 830, y2: 474}, {x1: 830, y1: 499, x2: 830, y2: 561}, {x1: 830, y1: 516, x2: 488, y2: 516}, {x1: 488, y1: 516, x2: 488, y2: 560}],
points: [{x1: 305, y1: 560, x2: 305, y2: 545}, {x1: 419, y1: 510, x2: 419, y2: 490}, {x1: 455, y1: 282, x2: 548, y2: 282}, {x1: 830, y1: 395, x2: 830, y2: 474}, {x1: 830, y1: 499, x2: 830, y2: 561}, {x1: 830, y1: 516, x2: 488, y2: 516}, {x1: 488, y1: 516, x2: 488, y2: 560}],
dot1: {x1: 650, y1: 885, x2: 650, y2: 852},
@@ -30,6 +31,10 @@ export default {
mounted () {
this.animate()
},
destroyed () {
window.cancelAnimationFrame(this.af)
this.af = undefined
},
methods: {
rectClick () {
var ev = window.event
@@ -142,7 +147,7 @@ export default {
for (let i = 0; i < this.points.length; i++) {
this.drawLine(ctx, this.points[i].x1, this.points[i].y1, this.points[i].x2, this.points[i].y2)
}
requestAnimationFrame(this.animate)
this.af = window.requestAnimationFrame(this.animate)
}
}
}