Prev Demo
Settransform()
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>SetTransform</title> </head> <body> <canvas id="myCanvas" width="300" height="150" style="border:2px dashed silver;"> Your browser does not support the HTML5 canvas tag. </canvas> <script> var a = document.getElementById("myCanvas"); var b = a.getContext("2d"); b.fillStyle = "yellow"; b.fillRect(0, 0, 250, 10) b.setTransform(1, 0.5, -0.5, 1, 30, 10); b.fillStyle = "red"; b.fillRect(0, 0, 250, 10); b.setTransform(1, 0.5, -0.5, 1, 30, 10); b.fillStyle = "blue"; b.fillRect(0, 0, 250, 10); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output