épaisseur trait

couleur trait

zoom

Votre navigateur ne supporte pas la balise canvas

<!DOCTYPE HTML>
<html lang = "fr">
<head>
	<title>tracer fonction</title>
	<meta charset = "utf-8" />
</head>
<body>
régler zoom <input type="range" id="zoom" min="1" max="10" step="0.1" value="1">
	<canvas id = "schema" height = "300" width ="400">
		Votre navigateur ne supporte pas la balise canvas
	</canvas>
<script>
	var zone_dessin = document.getElementById("schema");
	var graphe= zone_dessin.getContext("2d");
	var intervalle=setInterval(rafraichissement_ecran,30);
	function rafraichissement_ecran() {
		var zoom=document.getElementById("zoom");
		var compteur=0;
		graphe.clearRect(0,0,400,300);
		graphe.strokeStyle = "#0098f8";
		graphe.lineWidth=1;
		graphe.beginPath();
			graphe.moveTo(,f(0));
			while(compteur<300) {
				graphe.lineTo(zoom.value*compteur,f(compteur));
				compteur=(compteur+0.1);
		}						
		graphe.stroke();
	}
	function f(x) {
		var y=zoom.value*10*Math.sin(x);
		return (150-y);
	}
</script>
</body>
</html>