vibertthio/beact

Animation Structure

vibertthio opened this issue · 1 comments

    const origin = { x: two.width * 0.5, y: two.height * 1.5 };
    const destIn = { y: two.height * 0.5 };
    const destOut = { y: two.height * -0.5 };

    /**
     * [setDirection description]
     */
    function setDirection() {
      const direction = (Math.random() > 0.5);
      origin.x = two.width * 0.5;
      origin.y = two.height * (direction ? 1.5 : -0.5);
      destIn.y = two.height * 0.5;
      destOut.y = two.height * (direction ? -0.5 : 1.5);
    }

    setup() {
        ...
    }

    let { playing, shape, aniIn, aniOut } = setup();

可以把 origin, destIn, destOut 的設定放到 setup 裡面去統一輸出,這樣架構好像比較單純。

這個問題暫時還沒有定論,先不要 close。