Infinity: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 23: | Line 23: | ||
return function () {var x = pt[t].X(); | return function () {var x = pt[t].X(); | ||
var x1 = pt[(t+1)%4].X(); | var x1 = pt[(t+1)%4].X(); | ||
var s = S. | var s = S.Value(); | ||
return x+(x1-x)*s; | return x+(x1-x)*s; | ||
}}(i), | }}(i), | ||
Line 29: | Line 29: | ||
return function () {var y = pt[t].Y(); | return function () {var y = pt[t].Y(); | ||
var y1 = pt[(t+1)%4].Y(); | var y1 = pt[(t+1)%4].Y(); | ||
var s = S. | var s = S.Value(); | ||
return y+(y1-y)*s; | return y+(y1-y)*s; | ||
}}(i) | }}(i) | ||
Line 64: | Line 64: | ||
return function () {var x = pt[t].X(); | return function () {var x = pt[t].X(); | ||
var x1 = pt[(t+1)%4].X(); | var x1 = pt[(t+1)%4].X(); | ||
var s = S. | var s = S.Value(); | ||
return x+(x1-x)*s; | return x+(x1-x)*s; | ||
}}(i), | }}(i), | ||
Line 70: | Line 70: | ||
return function () {var y = pt[t].Y(); | return function () {var y = pt[t].Y(); | ||
var y1 = pt[(t+1)%4].Y(); | var y1 = pt[(t+1)%4].Y(); | ||
var s = S. | var s = S.Value(); | ||
return y+(y1-y)*s; | return y+(y1-y)*s; | ||
}}(i) | }}(i) |
Revision as of 13:24, 4 June 2009
Here jQuery is used instead of Prototype.
Just enjoy this construction...
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jquery.min.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<div id="jxgbox" class="jxgbox" style="width:800px; height:700px;"></div>
<script language="JavaScript">
var board = JXG.JSXGraph.initBoard('jxgbox', {originX: 300, originY: 300, unitX: 50, unitY: 50})
var S = board.createElement('slider', [[-5,-6],[5,-6],[0,0.5,1]], {name:'S'});
var points = new Array();
points[0] = board.createElement('point',[5, 5], {name:' '});
points[1] = board.createElement('point',[-5, 5], {name:' '});
points[2] = board.createElement('point',[-5, -5], {name:' '});
points[3] = board.createElement('point',[5, -5], {name:' '});
function quadrangle(pt, n) {
var arr = new Array();
for(var i = 0; i < 4; i++) {
arr[i] = board.createElement('point',
[function(t) {
return function () {var x = pt[t].X();
var x1 = pt[(t+1)%4].X();
var s = S.Value();
return x+(x1-x)*s;
}}(i),
function(t) {
return function () {var y = pt[t].Y();
var y1 = pt[(t+1)%4].Y();
var s = S.Value();
return y+(y1-y)*s;
}}(i)
],
{style:3, name:" "});
}
board.createElement('polygon',pt, {fillColor: '#5555'+n+''+n});
if(n>0)
quadrangle(arr, --n);
}
board.suspendUpdate();
quadrangle(points,30);
board.unsuspendUpdate();
</script>