I wrote some lines below:
function testScroll() {
if (window.pageYOffset > 400) {
for (var x=0; x<=2; x++){
newCircle(circle[x],circleId[x],startColorId[x],endColorId[x]);
};
};
};
window.onscroll = testScroll;
function works showing newCircles but it does as many times as user scroll down the page, the ideal will when the function stop if there are appering three circles on page,
I tried to change if condition to equal but it doesnt help, if you have any ideas please help