3 hours to GSOC results and HTML5 Canvas


It’s 2130hrs and I don’t know whether it’s the effect of sequence of events that occurred last night, or the extra sleep that I took in the evening that I am feeling low. At present, I am done with listening to emotional songs, sitting under stars for more than an hour but emptiness still prevails. Getting my mind off these ill thoughts would not be difficult. I just need to indulge myself in something. So the first thing would be to find that “something”.

 Gsoc results will be announced on 0027hrs and till that I m lame to do anything. vigasdeep(e-jerk) is online, and talking to this awesome jerk is always a pleasure. 

It’s 2140hrs and its decided, I will play a bit with
html5 and css3. I wanted to do it from so long, but never got sufficient motivation and time to do it. But this is the time, this is it. Let’s see what could I possibly do. The first thing will be to grab a nice book from amazon and then search for it in rabidlibrary or ebookee, yeah I know that’s piracy, and I don’t care

After browsing through various books for an hour, I ended up with choosing two books Foundation Html5 canvas and Html5 cookbook. I have been fan of both cookbook series and foundation series from the time when I used to learn actionscript3, that reminds me of my pending game, will come back to it later.

It’s 0030 hrs, of the next day here in India. www.google-melange.com is giving a server error. Forget the melange, wonderful thing is that I have created my first painting on html5 canvas, here it is.
My first Html5 canvas painting. 

I know it’s not a masterpiece, but damn at least I did something useful with my time. Also it contains almost all the basic elements of canvas. Rectangle, line, arc and text are the four things that i learned today. 

Its 0140 hrs, the list is out and as expected my name is not anywhere. Vigas says he is relaxed, but I know what this e-jerk is feeling. Time to snore harder than my sleeping brother.









If there is one noupe head amazed by this noupe work, he can copy paste the code below or do some changes to make it his own.


<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="500" height="500" style="border:1px solid #d3d3d3;">
your browser does not support the canvas tag </canvas>
<script type="text/javascript">
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
/*canvas.attr("width", $(window).get(0).innerWidth);
canvas.attr("height", $(window).get(0).innerHeight);*/
// USED WITH JQUERY
var text= "Inder+";
ctx.font = "bold 100px serif";
ctx.strokeText(text, 140,350);
ctx.beginPath();
ctx.lineWidth = 10;
ctx.strokeStyle="rgb(0,0,0)"; ctx.moveTo(40,40);
ctx.lineTo(340,40);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.fillStyle = "rgb(10,255,150)";
ctx.fillRect(40,40,100,500);
ctx.fillStyle= "rgb(255,100,50)";
ctx.strokeStyle= "rgb(255,100,50)";
ctx.arc(340,250,50,0,Math.PI*2, false);
ctx.fill();
//context.arc(x, y, radius, startAngle, endAngle, anticlockwise);

</script>
</body>
</html>


No comments:

Post a Comment