Skip to content

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