var line = { x: 300, y: 200, length: 100, angle: 0 }; // ... line.angle += (Math.PI*2) / 100; var x = line.x + line.length * Math.cos(line.angle); var y = line.y + line.length * Math.sin(line.angle);