fillText to add Text to CanvasDrag the sliders to change the X, Y position of lineTo().
text: text string to display. x: Position from left edge of the canvas,starting point of the text y: Position from Top edge of the canvas, stating point of the text. maxWidth: Optional, Font is adjusted to match the width. var my_canvas=$('#my_canvas').get(0) var gctx = my_canvas.getContext("2d"); gctx.font = '46px serif'; gctx.fillText('plus2net.com', 100,100);fillStyle() can be used to add colour or colour gradient to rectangle, default is black. Select two colours from this colour table ( click twice to select addColorStop 1 and addColorStop 2) Start Colour End Colour By adding colour gradientvar my_canvas=$('#my_canvas').get(0) var gctx = my_canvas.getContext("2d"); my_gradient=gctx.createLinearGradient(100,100,380,130); my_gradient.addColorStop(0,'#f50000'); my_gradient.addColorStop(1,'#69f5f5'); gctx.fillStyle=my_gradient; gctx.font = '46px serif'; gctx.fillText('plus2net.com', 100,100);
This article is written by plus2net.com team.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||