Javascript setTimeout function

前端 未结 6 1236
长发绾君心
长发绾君心 2021-01-14 11:56

I am calling this function

function drawLayers() {

    //setTimeout(drawBlueSky,500);
    //setTimeout(drawCircle1,1250);
    setTimeout(drawMoon,800);
             


        
6条回答
  •  不知归路
    2021-01-14 12:37

    Set your stop button to set a flag (ex. stopPressed = true;). I would write a function drawNextLayer(previousLayer).

    Then write

    while (stopPressed === false && previousLayer !== lastLayer) {
        drawNextLayer(previousLayer);
        previousLayer++;
    }
    

提交回复
热议问题