HTML canvas transform() Method Read Courses Improve Improve Improve Like Article Like Save Article Save Report issue Report The transform() method is used to replace the current transformation matrix i.e. each object on the canvas has a current transformation matrix. The transform() method is used to multiply that current transformation matrix with the matrix described below: a c e b d f 0 0 1 It simply allows to scale, move, skew and rotate the current context. Syntax: context.transform(a, b, c, d, e, f); Parameter Values: a denotes Horizontal scaling b denotes Horizontal skewing c denotes Vertical skewing d denotes Vertical scaling e denotes Horizontal moving f denotes Vertical moving Example: <!DOCTYPE html> <html> <body> <h3 style="color:green"> GeeksforGeeks </h3> <h3 style="color:green"> HTML canvas transform() method </h3> <canvas id="gfgCanvas" width="400" height="300" style="border:2px solid ;"> </canvas> <script> var gfg = document.getElementById("gfgCanvas"); var context = gfg.getContext("2d"); context.fillStyle = "green"; context.fillRect(80, 80, 200, 100) context.transform(1, 0, 2, 2, 10, 10); context.fillStyle = "black"; context.fillRect(20, 20, 20, 80); </script> </body> </html> Output: Supported Browsers: Chrome Mozilla Firefox Internet Explorer 9.0 Opera Safari Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 12 Jun, 2023 Like Article Save Article Previous HTML canvas translate() Method Next HTML canvas setTransform() Method Share your thoughts in the comments Add Your Comment Please Login to comment...