<!DOCTYPE HTML>
<html>
<body>
<canvas id="myCanvas" width="800" height="500" style="border:3px solid #FFFF00;"></canvas>
<!--Setting of size of Canvas-->
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var x = canvas.width / 2;<!--center of x axis-->
var y = canvas.height / 2;<!--center of y axis-->
context.fillStyle = "yellow";
context.fillRect(x-300,y-200,600,400);
context.clearRect(x-200,y-100,400,200);
</script>
</body>
</html>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.