mercredi 24 janvier 2018

en cours ...

<canvas id="myCanvas" width="400" height="400" style="border:1px solid #c0c0c0;">Your browser does not support the canvas element.</canvas>

<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
var a = Math.floor(400*Math.random());
var b = Math.floor(400*Math.random());
var c = Math.floor(400*Math.random());
var d = Math.floor(400*Math.random());
var f1 = '#0FF000'
var f2 = '#FF0000'

if (condition) {
    block of code to be executed if the condition is true
} else {
    block of code to be executed if the condition is false
}

ctx.fillStyle = f1;
ctx.fillRect(a,b,100,100);

ctx.fillStyle = f1;
ctx.fillRect(c,d,100,100);

</script>