Colorful circles: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
<jsxgraph width="600" height="600">
<jsxgraph width="600" height="600">
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]});
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]});
var i;
var i, h, s, v;


for (i=0;i<30;i++) {
  h = Math.random()*360
  s = Math.random();
  v = 1.0;
  brd.createElement('point',[Math.random(),Math.random()],
    {
      withLabel:false,
      face:'circle',
      size:Math.random()*100,
      strokeColor:JXG.hsv2rgb(h,s,v),
      fillColor:JXG.hsv2rgb((h+180)%360,s,v),
      fillOpacity:0.7
      });
}
</jsxgraph>
===The underlying JavaScript code===
<source lang="javascript">
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]});
var i, h, s, v;


for (i=0;i<30;i++) {
for (i=0;i<30;i++) {
   var h = Math.random()*360;
   h = Math.random()*360
   var s = Math.random();
   s = Math.random();
   var v = 1.0; //Math.random();
   v = 1.0;
   brd.createElement('point',[Math.random(),Math.random()],
   brd.createElement('point',[Math.random(),Math.random()],
     {withLabel:false, face:'circle',  
     {
      size:Math.random()*100,
      withLabel:false,  
      strokeColor:JXG.hsv2rgb(h,s,v),
      face:'circle',  
      fillColor:JXG.hsv2rgb((h+180)%360,s,v),
      size:Math.random()*100,
      fillOpacity:0.7
      strokeColor:JXG.hsv2rgb(h,s,v),
      fillColor:JXG.hsv2rgb((h+180)%360,s,v),
      fillOpacity:0.7
       });
       });
}
}
</jsxgraph>
</source>

Revision as of 10:08, 22 September 2009

The underlying JavaScript code

var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]});
var i, h, s, v;

for (i=0;i<30;i++) {
  h = Math.random()*360
  s = Math.random();
  v = 1.0;
  brd.createElement('point',[Math.random(),Math.random()],
     {
       withLabel:false, 
       face:'circle', 
       size:Math.random()*100,
       strokeColor:JXG.hsv2rgb(h,s,v),
       fillColor:JXG.hsv2rgb((h+180)%360,s,v),
       fillOpacity:0.7
      });
}