How can I use the tag canvas
of HTML5 and make this change in real time as I enter the data in input
? I already made form
and put tag canvas
on the page. I would like to know if in%% of% it is possible to change the data that I enter in JQuery
and at the same time change the measurement of input
:
Code :
<input type="text"name="largura"/>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var largura = document.getElementById("largura").focus().value;
var altura = document.getElementById("altura")..focus().value;
ctx.fillStyle = "#FF0000";
ctx.fillRect(5,5,largura,altura);
</script>
What would be the function in canvas
that would change these variables in real time?