Animation III: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 8: | Line 8: | ||
} | } | ||
setInterval(function(){ | setInterval(function(){ | ||
var i; | var i, j; | ||
for (i=0;i<p.length;i++) { | for (i=0;i<p.length;i++) { | ||
p[i].moveTo([Math.random(),Math.random()],1800); | p[i].moveTo([Math.random(),Math.random()],1800); | ||
} | |||
for (i=0;i<p.length;i++) { | |||
for (j=i+1;j<p.length;j++) { | |||
if (p[i].Dist(p[j])<0.05) { | |||
brd.removeObject(p[j]); | |||
p.splice(j,1); | |||
} | |||
} | |||
} | } | ||
},2000); | },2000); | ||
</jsxgraph> | </jsxgraph> |