<canvas id="myCanvas2" width="400" height="400" style="border:1px solid #c0c0c0;">Your browser does not support the canvas element.</canvas>
<script>
var canvas = document.getElementById("myCanvas2");
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 r = Math.floor(95*Math.random())+5;
var f1 = '#0FF000'
var f2 = '#FF0000'
var dx = (a + r) - (c + r);
var dy = (b + r) - (d + r);
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 2*r) {
var f1 = '#FF0000'
} else {
var f1 = '#0FF000'
}
ctx.beginPath();
ctx.fillStyle = f1;
ctx.arc(a,b,r,0,2*Math.PI);
ctx.fill();
ctx.beginPath();
ctx.fillStyle = f1;
ctx.arc(c,d,r,0,2*Math.PI);
ctx.fill();
</script>
jeudi 25 janvier 2018
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>
<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>
mardi 23 janvier 2018
Mario
<svg width="400" height="250">
<image xlink:href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQN4sUiHERRVk6GIC42PH7N4jhI0GHa_hb7bNmGTrNSeYoTzXHKGSxjeK9DkTJ9HkXCTZ384fkufYFaAdo3_m2LfWvicN9ZoTra62AGXJ5DC37a6Li8XciW5l5UzK4gMuhhcIRt-RDlA/s1600/mario1.png" x="0" y="0" width="400" height="250"/>
<g>
<image xlink:href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9NYi_Rdb-qP2ghsfCccNnyUZEl0ghZDRzpytYnNTt6iDY0bau5sITt30YFSJ80znamlGmBQpKDU_uIRNdlYFmcKfQYxdjV6HPIOSPNm9NfoVD7eW12oK7yNtVUJlUpynEkPBDQ8d2MQ/s1600/mario2.png" x="0" y="0" width="400" height="250"/>
<animateTransform attributeType="xml" attributeName="transform" type="rotate" values="0 175 130;360 175 130" dur="2s" repeatCount="indefinite"/>
</g>
</svg>
<image xlink:href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQN4sUiHERRVk6GIC42PH7N4jhI0GHa_hb7bNmGTrNSeYoTzXHKGSxjeK9DkTJ9HkXCTZ384fkufYFaAdo3_m2LfWvicN9ZoTra62AGXJ5DC37a6Li8XciW5l5UzK4gMuhhcIRt-RDlA/s1600/mario1.png" x="0" y="0" width="400" height="250"/>
<g>
<image xlink:href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9NYi_Rdb-qP2ghsfCccNnyUZEl0ghZDRzpytYnNTt6iDY0bau5sITt30YFSJ80znamlGmBQpKDU_uIRNdlYFmcKfQYxdjV6HPIOSPNm9NfoVD7eW12oK7yNtVUJlUpynEkPBDQ8d2MQ/s1600/mario2.png" x="0" y="0" width="400" height="250"/>
<animateTransform attributeType="xml" attributeName="transform" type="rotate" values="0 175 130;360 175 130" dur="2s" repeatCount="indefinite"/>
</g>
</svg>
mardi 16 janvier 2018
Inscription à :
Articles (Atom)
-
Generate
-
<html lang="fr"> <head> <title>Eyes</title> <style> html,body{ height:100%; margin:0; } #left_eye{ t...
-
Animation attribute (width, opacity, etc.) <animate attributeName="?" begin="0s" dur="6s" repeatCount...