I used the example of this website : http://openlayers.org/en/v3.8.2/examples/feature-animation.html for make an animation.
I don't have problem for stopping the event with the function
clearInterval(interval); if I declare before my interval
var interval = window.setInterval(addRandomFeature,1000);
The problem is I want to clear the layer who contain the object (after my function
clearInterval(interval);) and I don't understand what's the layer who contain the event and I don't know how can I clear this layer.