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

Flip Y , make the result be natural. #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Flip Y , make the result be natural. #33

wants to merge 1 commit into from

Conversation

finscn
Copy link
Contributor

@finscn finscn commented Mar 19, 2019

Before change:
image

After change:

image

In most real scenes , when the container is a top-short & bottom-long trapezoid , the children also should be "top-short & bottom-long".
Like this :
image

So I think this PR is necessary.

@finscn
Copy link
Contributor Author

finscn commented Mar 19, 2019

I know we could use factor=-1 to flip Y ,
but if use factor=-1 , when we move squareY , the result is not as same as expected

@finscn
Copy link
Contributor Author

finscn commented Mar 20, 2019

I see. I could change the example code like this:

app.ticker.add(function (delta) {
    // now we can get local coords for points of perspective
    let posX = container.toLocal(squareX.position, undefined, undefined, undefined, PIXI.projection.TRANSFORM_STEP.BEFORE_PROJ);
    container.proj.setAxisX(posX, squareX.factor);

    let posY = container.toLocal(squareY.position, undefined, undefined, undefined, PIXI.projection.TRANSFORM_STEP.BEFORE_PROJ);
    posY.y = -posY.y;
    posY.x = -posY.x;
    container.proj.setAxisY(posY, -squareY.factor);
});

But If use this PR , the code

    posY.y = -posY.y;
    posY.x = -posY.x;
    container.proj.setAxisY(posY, -squareY.factor);

could be removed .
just leave one line :

 container.proj.setAxisY(posY, squareY.factor);

image

the code will be clear.

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

Successfully merging this pull request may close these issues.

1 participant