i´m working on an interactive Infographic. Basically there are is a number of circles flying around. I try to change the amount of circles by clicking on a button, therefor I want to increase the variable d by 1 on click, to get an other element from the array. But it doesnt´t work. Any ideas?
var leuko = ["167", "143", "134", "96"]; //array
var d = 0; //variable
$("#day").click(function() {
d += 1;
_
for (var i = 0; i < leuko[d]; i++) {
var x = 20 + (Math.random() * (canvasWidth - 40));
var y = 20 + (Math.random() * (canvasHeight - 40));
var radius = 5;
var vX = Math.random() * 0.2;
var vY = Math.random() * 0.2;
I hope you can understand my problem, as my english isn´t the best.
Here is a jsfiddle-link. Layout looks a little bit messed up..
Thanks!
d, but the problem is, that this variable is used only once on document ready..dis incrementing fine. jsfiddle.net/JDU6H/1