December 27, 2017

Posted from CL using EasyBlogger

This article is posted from the commandline using a nice utility EasyBlogger for my post on Medium. Thank you Raghu for creating such a wonderfool tool. The blogging community appreciates it very much.

May 7, 2013

Canvas Part-3 demo -2


<!DOCTYPE html>
<html>
 <body>
    <canvas id="myCanvas" width="600" height="400"></canvas>
    <script>
      var canvas = document.getElementById('myCanvas');
      var context = canvas.getContext('2d');
    // square linecap
      context.beginPath();
      context.moveTo(200, 200);
      context.lineTo(canvas.width - 200, 100);
      context.lineWidth = 20;
      context.strokeStyle = 'red';
      context.lineCap = 'square';
      context.stroke();
      // butt linecap
      context.beginPath();
      context.moveTo(200, 250);
      context.lineTo(400, 250);
      context.lineWidth = 10;
      context.strokeStyle = '#0000ff';
      context.lineCap = 'butt';
      context.stroke();

      // round linecap
      context.beginPath();
      context.moveTo(200, 300);
      context.lineTo(400, 300);
      context.lineWidth =15;
      context.strokeStyle = 'green';
      context.lineCap = 'round';
      context.stroke();
 </script>
  </body>
</html>

You must define lineCap ,linewidth  ,strokeStyle properties before stroke( ).

Canvas Part-3 demo-1

Your browser does not support the HTML5 canvas tag.
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="400" height="200" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginpath( );
ctx.moveTo(10,10);
ctx.lineTo(200,100);
ctx.stroke();
</script>
</body>
</html>

Canvas Part -2 Demo




<!doctype html>
<html>
<body>
<canvas height="350" id="canvas2" style="border: 1px groove #000000;" width="600">
It seems your browser doesn't support canvas .Please upgrade to newer version of browser.
</canvas>
</body>
</html>



Tic Tac Toe


 Display is given below:


Instructions:
1)Click on the box to select ur choice
2)Below the play area, the name of the player who has to make the move is given (either Player 'x' or Player 'O')
3)To play again, just reload the page

This is written using Javascript ...

Bouncer ball with gravity & elasticity