Difference between revisions of "Colorful circles"

From JSXGraph Wiki
Jump to navigationJump to search
 
(27 intermediate revisions by the same user not shown)
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]});
+
JXG.Options.point.zoom = true;
var i;
+
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1], takeFirst: false});
 +
var i, h, s, v;
  
 +
brd.suspendUpdate();
 +
for (i=0;i<100;i++) {
 +
  h = Math.random()*360;
 +
  s = Math.random();
 +
  v = 1.0;
 +
  brd.create('point',[Math.random(),Math.random()],
 +
    {
 +
      withLabel:false,
 +
      face:'circle',
 +
      size:Math.random()*65,
 +
      strokeColor:JXG.hsv2rgb(h,s,v),
 +
      fillColor:JXG.hsv2rgb((h+180)%360,s,v),
 +
      highlightFillColor:JXG.hsv2rgb(h,s,v),
 +
      fillOpacity:0.7,
 +
      highlightFillOpacity:0.4
 +
      });
 +
}
 +
brd.unsuspendUpdate();
 +
</jsxgraph>
  
for (i=0;i<20;i++) {
+
===The underlying JavaScript code===
  var h = Math.random()*360;
+
<source lang="javascript">
  var s = Math.random();
+
JXG.Options.point.zoom = true;
  var v = Math.random();
+
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]});
  brd.createElement('point',[Math.random(),Math.random()],
+
var i, h, s, v;
    {withLabel:false, face:'circle',
 
      size:Math.random()*100,
 
      strokeColor:brd.hsv2rgb(h,s,v),
 
      fillColor:brd.hsv2rgb((h+180)%360,s,v)
 
  
 +
for (i=0;i<30;i++) {
 +
  h = Math.random()*360;
 +
  s = Math.random();
 +
  v = 1.0;
 +
  brd.create('point',[Math.random(),Math.random()],
 +
    {
 +
      withLabel:false,
 +
      face:'circle',
 +
      size:Math.random()*65,
 +
      strokeColor:JXG.hsv2rgb(h,s,v),
 +
      fillColor:JXG.hsv2rgb((h+180)%360,s,v),
 +
      highlightFillColor:JXG.hsv2rgb(h,s,v),
 +
      fillOpacity:0.7,
 +
      highlightFillOpacity:0.4
 
       });
 
       });
 
}
 
}
</jsxgraph>
+
</source>
 +
 
 +
[[Category:Examples]]

Latest revision as of 21:08, 14 November 2020

The underlying JavaScript code

JXG.Options.point.zoom = true;
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.create('point',[Math.random(),Math.random()],
     {
       withLabel:false, 
       face:'circle', 
       size:Math.random()*65,
       strokeColor:JXG.hsv2rgb(h,s,v),
       fillColor:JXG.hsv2rgb((h+180)%360,s,v),
       highlightFillColor:JXG.hsv2rgb(h,s,v),
       fillOpacity:0.7,
       highlightFillOpacity:0.4
      });
}