Created
July 28, 2017 14:51
-
-
Save ingeit/3f09514f897f6e9d31daac9c5df9eea6 to your computer and use it in GitHub Desktop.
usar canvas typescript Raw
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