I want to change the x and y coordinates of the svg line, but it keeps drawing multiple lines itself over and over again. Here is the result: http://prntscr.com/6tdexj
How do I draw only one line every 1 second ?
var paper = Snap('#one'); var timer = setInterval(function() {my_var()}, 1000); function my_var() { x = Math.floor((Math.random() * 100) + 1); y = Math.floor((Math.random() * 100) + 1); console.log(x, y); // SVG LINE var line = paper.line(10, 10, x, y).attr({ fill: 'f44', stroke: '#000' }); };