question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

why pixi skew was not same as css3 transform skew

See original GitHub issue

when i use skew to transform a display-object, i get a different results. it`s not same as css3 transform skew. so I want to know what this is about ~~~

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
jasonChen1982commented, Nov 10, 2017

i had found css3 skew and pixi skew was used different matrix, i had just adjust code snippet from pixi skew to css3 skew

function setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) {
    const sr = Math.sin(rotation);
    const cr = Math.cos(rotation);
    const sx = Math.tan(skewX);
    const sy = Math.tan(skewY);

    const a =  cr * scaleX;
    const b =  sr * scaleX;
    const c = -sr * scaleY;
    const d =  cr * scaleY;

    this.a =    a   + sy * c;
    this.b =    b   + sy * d;
    this.c = sx * a +    c;
    this.d = sx * b +    d;

    this.tx = x + pivotX * this.a + pivotY * this.c;
    this.ty = y + pivotX * this.b + pivotY * this.d;

    return this;
}

css3 skew matrix

|    1      tan(x)    0|
| tan(y)      1       0|
|    0        0       1|

pixi skew matrix

| cos(y)   -sin(x)   0|
| sin(y)   cos(x)    0|
|    0        0      1|
1reaction
OSUblakecommented, Dec 4, 2017

Actually Greensock has a parameter like “skewType: normal” or something similar to make the skew like CSS. Is there a way to do the same in pixi? It will me save a lot of time 😃

Hehe. That’s what I used in that demo above to show the difference.

But no, there currently isn’t an option for that. After reading my comment, it might not be clear, but that’s actually what I was trying to suggest. Have an option for the 2 different types, with the way skewing is currently done set as the default skew type.

Read more comments on GitHub >

github_iconTop Results From Across the Web

why pixi skew was not same as css3 transform skew #4417
The biggest problem with PixiJS is that it doesn't have a transform origin like CSS. The default transform origin for an element is...
Read more >
SkewX SkewY work not as expected - GSAP - GreenSock
Skew and rotation values impact each other greatly and your object that is spinning and skewing only has one css transform value applied....
Read more >
Camera | Pixi3D - v2.1.0
The center of rotation, scaling, and skewing for this display object in its local space. The position is the projection of pivot in...
Read more >
pixi.js line skew - CodePen
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >
skew() - CSS: Cascading Style Sheets - MDN Web Docs
The skew() CSS function defines a transformation that skews an element on the 2D plane. Its result is a <transform-function> data type.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found