N-gones - Slow version: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script> | <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script> | ||
<form><textarea id="inputtext" rows=12 cols=35 wrap="off" style="width:600px;"> | <form><textarea id="inputtext" rows=12 cols=35 wrap="off" style="width:600px;"> | ||
/* | |||
function mn_eck(ne,sz) { | |||
for(var i=ne;i>0;i--) { | |||
t.rt(360/ne); | |||
for(var j=ne;j>0;j--) { | |||
t.rt(360/ne); | |||
t.fd(sz); | |||
} | |||
} | |||
} | |||
*/ | |||
function mn_eck(ne,sz) { | |||
outerloop(ne,sz); | |||
} | |||
t.cs().hideTurtle().setProperty({strokeWidth:4,strokeOpacity:0.6,fillOpacity:0.3}); | t.cs().hideTurtle().setProperty({strokeWidth:4,strokeOpacity:0.6,fillOpacity:0.3}); | ||
mn_eck(7,80); | |||
</textarea><br /> | </textarea><br /> | ||
<input type="button" value="run" onClick="runturtle()"> | <input type="button" value="run" onClick="runturtle()"> | ||
Line 16: | Line 32: | ||
var t = brd.createElement('turtle',[],{fillColor:'yellow'}); | var t = brd.createElement('turtle',[],{fillColor:'yellow'}); | ||
function | function outerloop(ne,sz) { | ||
if ( | if (ne>0) { | ||
t.rt(360/ne); | t.rt(360/ne); | ||
for(var j=ne;j>0;j--) { | |||
t.rt(360/ne); | |||
t.fd(sz); | |||
} | } | ||
var st = ' | var st = 'outerloop('+(ne-1)+','+sz+')'; | ||
alert(st); | |||
setTimeout(st,25); | setTimeout(st,25); | ||
} | } | ||
} | } | ||
function runturtle() { | function runturtle() { |
Revision as of 16:06, 25 February 2009