Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation Structure #3

Open
vibertthio opened this issue Jun 24, 2017 · 1 comment
Open

Animation Structure #3

vibertthio opened this issue Jun 24, 2017 · 1 comment

Comments

@vibertthio
Copy link
Owner

vibertthio commented Jun 24, 2017

    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 裡面去統一輸出,這樣架構好像比較單純。

@vibertthio
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant