I m a little confused to what HTML5 canvas is. I ve been told it is JavaScript, but it seems to be a much bigger deal?
What makes it different than javascript?
Why is it so amazing?
Does it do other things than JavaScript?
I m a little confused to what HTML5 canvas is. I ve been told it is JavaScript, but it seems to be a much bigger deal?
What makes it different than javascript?
Why is it so amazing?
Does it do other things than JavaScript?
I suggest you read this article HTML5 Canvas - the basics
But in short. It does not replace javascript.
HTML 5 canvas gives you an easy and powerful way to draw graphics using JavaScript. For each canvas element you can use a "context" (think about a page in a drawing pad), into which you can issue JavaScript commands to draw anything you want. Browsers can implement multiple canvas contexts and the different APIs provide the drawing functionality.
The canvas
is basically an img
element that you can draw on using javascript.
The Canvas element is essentially a drawing canvas that can be painted on programmatically; a sort of scriptable bitmap drawing tool for the web.
I suppose the "amazing" thing about it, apart from the fact that we can now all create web-based MS Paint clones with ease, is that you have a much richer, completely free-form area for creating complex graphics client-side and on-the-fly. You can draw pretty graphs, or do things with photos. Allegedly, you can also do animation!
Mozilla s Developer Center has a reasonable tutorial if you want to try it out.
First of all, Canvas is NOT JavaScript! These 2 are totally different things.
Canvas is a HTML5 element that can be used for rendering graphics, animation, graphs, photo compositions or any other visual objects on the fly by using JavaScript. More often, canvas has used for building web game and online presentation.
See the following example which draws a line on the canvas:
<html>
<body>
<canvas id="c" width="200" height="200" style="border:1px solid"></canvas>
<script>
var canvas = document.getElementById("c");//get the canvas in javascript
var context = canvas.getContext("2d");//getcontext on canvas
context.beginPath();//start the path.we are going to draw the line
context.moveTo(20,20);//starting point of Line
context.lineTo(40,20);//ending point of Line
context.stroke(); //ink used for drawing Line (Default: Black)
</script>
</body>
</html>
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!