Malisa Huzaifa - Web Multimedia HTML6 Canvas & SVG

33 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML5 Canvas</title> </head> <body> <canvas id="canvas" width="200" height="150" style="border:1px solid #DC143C; background-color: black"></canvas> <button type="button" onclick="rotasi();">Klik</button> <script type="text/javascript"> var cvs = document.getElementById("canvas"); var ctx = cvs.getContext("2d"); ctx.font = "30px italic"; ctx.textAlign = "center"; ctx.fillStyle = "yellow"; ctx.fillText("Rotasi", cvs.width/2, cvs.height/2); function rotasi (event) { ctx.translate(cvs.width/2, cvs.height/2); ctx.rotate((Math.PI / 180) * 15);

RkJQdWJsaXNoZXIy MTM3NDc5MQ==