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