Why aren’t my ball (objects) shrinking/disappearing?

http://jsfiddle.net/goldrunt/jGL84/42/
this is from line 84 in this JS fiddle. There are 3 different effects which can be applied to the balls by uncommenting lines 141-146. The ‘bounce’ effect works as it should, but the ‘asplode’ effect does nothing. Should I include the ‘shrink’ function inside the asplode function?

// balls shrink and disappear if they touch
var shrink = function(p) {
    for (var i = 0; i < 100; i++) {
        p.radius -= 1;
    }
    function asplode(p) {
        setInterval(shrink(p),100);
        balls.splice(p, 1);
    }
}

2 Answers
2

Leave a Comment