| | |
| | | ctx = uni.createCanvasContext('myCanvas', this); |
| | | |
| | | // 设置字体样式 |
| | | ctx.setFontSize(this.canvasHeight * 0.9); |
| | | ctx.setFontSize(this.canvasHeight); |
| | | ctx.setFillStyle('#000') |
| | | ctx.setTextAlign('center') |
| | | ctx.setTextBaseline('middle') |
| | |
| | | // 水平居中 |
| | | const x = this.canvasWidth / 2; |
| | | // 垂直居中,稍微向上偏移一点 |
| | | const y = this.canvasHeight / 2; |
| | | const y = this.canvasHeight / 2 + 10; |
| | | |
| | | // 绘制文字 |
| | | ctx.fillText(char, x, y); |
| | |
| | | startPreviewAnimation() { |
| | | this.stopPreviewAnimation(); |
| | | if (!this.speed || this.speed <= 0 || this.previewFrames.length === 0) return; |
| | | const interval = 1000 / this.speed; |
| | | const interval = this.speed * 2.8; |
| | | console.log('interval', interval) |
| | | this.previewTimer = setInterval(() => { |
| | | this.previewFrameIndex = (this.previewFrameIndex + 1) % this.previewFrames.length; |
| | | }, interval); |