| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>JSXGraph example</title> |
| 4 |
<link rel="stylesheet" type="text/css" href="../distrib/jsxgraph.css" /> |
| 5 |
<script type="text/javascript" src="prototype.js"></script> |
| 6 |
<script type="text/javascript" src="../distrib/jsxgraphcore.js"></script> |
| 7 |
</head> |
| 8 |
<body> |
| 9 |
<h2>Colorful tangents</h2> |
| 10 |
<div style="width:800px"> |
| 11 |
<div id="jxgbox" class="jxgbox" style="width:600px; height:450px; float:left"></div> |
| 12 |
</div> |
| 13 |
<div id="debug" style="display:block;"></div> |
| 14 |
<script type="text/javascript"> |
| 15 |
/* <![CDATA[ */ |
| 16 |
JXG.Options.layer.curve = 8; |
| 17 |
|
| 18 |
|
| 19 |
var board, cons, p = [], t=[], f; |
| 20 |
board = JXG.JSXGraph.initBoard('jxgbox', {grid:true, originX: 300, originY: 400, unitX: 50, unitY: 50, axis:true}); |
| 21 |
board.suspendUpdate(); |
| 22 |
var j=0; |
| 23 |
f= board.create('functiongraph', [function(x){ return x*x;}, -4, 4], {strokeColor:'black', strokeWidth:'2pt'}); |
| 24 |
for(i=-3; i<=3; i=i+0.25) { |
| 25 |
p.push(board.create('glider',[i,i*i,f],{strokeColor:'black', fillColor:JXG.hsv2rgb(j*360/25,1,1)})); |
| 26 |
t.push(board.create('tangent', [p[p.length-1]], { strokeColor:JXG.hsv2rgb(j*360/25,1,1) })); |
| 27 |
j++; |
| 28 |
} |
| 29 |
board.unsuspendUpdate(); |
| 30 |
/* ]]> */ |
| 31 |
</script> |
| 32 |
</body> |
| 33 |
</html> |