• Use canvas to sign a picture


    Demand: Sign the author’s name in the picture and center it in the specified underline position. The image generated by canvas can be downloaded and the size is suitable for printing Realization idea: Using canvas to realize a canvas this.canvas = document.createElement(‘canvas’); this.canvas.className = ‘cert-canvas’; this.ctx = this.canvas.getContext(‘2d’); Then draw the picture on canvas let […]

  • JavaScript graphic example: random Sierpinski triangle


          stay“JavaScript graphic example: Sierpinski triangle”In this paper, we introduce the basic drawing method of Sierpinski triangle“JavaScript graphics example: iterated function system generated graphics”In this paper, the method of generating Sierpinski triangle by IFS is introduced. Next, we introduce two construction methods of Sierpinski triangle to expand the knowledge. 1. Random point method […]

  • Font structure and text vertical center scheme


    Image source:https://unsplash.com/photos/G…Author: Feng Hao 1. Introduction Vertical center is basically a problem that must be mastered by beginners of CSS. We must have seen “CSS vertical center n” in various tutorials Generally speaking, these methods can meet all kinds of use scenarios. However, when we encounter the situation that we need to use some special […]

  • The horizontal and vertical center of canvas in applet


    To make a scratch card recently, you need to center the text horizontally and vertically in canvas wxml <canvas type=’2d’ id=”myCanvas” width=”300″ height=”150″ style=”background:yellow;” \> Using canvas2d to build a canvas The blue line is the horizontal center lineThe red line is the vertical center line Text setting method fillTextMethod to set the text method […]