Created
July 22, 2017 13:39
-
-
Save masterk63/a73a5be81ae4fd8fc46f6d0713313f14 to your computer and use it in GitHub Desktop.
usar canvas typescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ViewChild } from '@angular/core'; | |
@ViewChild('myCanvas') canvas: any; | |
canvasElement: any; | |
ctx:any; | |
ngAfterViewInit(){ | |
this.canvasElement = this.canvas.nativeElement; | |
this.ctx = this.canvasElement.getContext('2d'); | |
} | |
otraFuncion(){ | |
// ejemplo de trabajo con canvas | |
this.ctx.clearRect(0,0,this.canvasElement.width,this.canvasElement.height); | |
this.ctx.drawImage(this.imagenHTML, 0, 0); | |
this.ctx.fillStyle = "blue"; | |
this.ctx.fillText('kevin',200,120); | |
this.ctx.fillText('34159181',200,220); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment