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

Matrix tests - skew #548

Open
MannyC opened this issue Dec 29, 2014 · 1 comment
Open

Matrix tests - skew #548

MannyC opened this issue Dec 29, 2014 · 1 comment

Comments

@MannyC
Copy link
Contributor

MannyC commented Dec 29, 2014

So I've done a first draft of some Matrix2D tests (I'll link the code in a second).

My main issues are that the decomposition test is unverified (i.e. I did the comparison calculations in easeljs, so obviously it's going to pass at this point) and that the EaselJS skew isn't working in the same was as my calculations.

easeljs skew method:

p.skew = function(skewX, skewY) {
    skewX = skewX*Matrix2D.DEG_TO_RAD;
    skewY = skewY*Matrix2D.DEG_TO_RAD;
    this.append(Math.cos(skewY), Math.sin(skewY), -Math.sin(skewX), Math.cos(skewX), 0, 0);
    return this;
};

whereas I was using tans, which in easel would be

p.skew = function(skewX, skewY) {
    skewX = skewX*Matrix2D.DEG_TO_RAD;
    skewY = skewY*Matrix2D.DEG_TO_RAD;
    this.append(1, Math.tan(skewY), Math.tan(skewX),1, 0, 0);
    return this;
};

This is how it is done in CSS

They appear to give somewhat similar results except that the cos/sin method does add a scaling component.

Thoughts? I can just change to the cos/sin method if there's a reason for it.

MannyC added a commit to MannyC/EaselJS that referenced this issue Dec 29, 2014
@gskinner
Copy link
Member

I'll have to look into this some more. IIRC, our skew is based off of Flash's skew (which is a visual vs mathematical skew). It's unlikely we'd change it at this point regardless, but perhaps we could add a cssSkew method to matrix, or something similar (just brainstorming here).

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

2 participants