pixijs / filters

Collection of community-authored custom display filters for PixiJS
https://pixijs.io/filters/docs/
MIT License
967 stars 158 forks source link

`BevelFilter` rotation defaults to 0° instead of 45° #456

Closed plurry closed 7 months ago

plurry commented 7 months ago

The constructor ignores the rotation value, but setting it after initialization works: https://jsfiddle.net/3anhs0pw/

Also, to be consistent, I think rotation values should be in radians like in Pixi, while angle values would be in degrees.

plurry commented 7 months ago

This bug isn't there with Pixi 7 and Filters 5: https://jsfiddle.net/buo96kmv/

I haven't built it and made sure that this is the problem, but It looks like it's a degrees-to-radians conversion bug. rotation is multiplied by DEG_TO_RAD once when it's initialized: https://github.com/pixijs/filters/blob/ca0c344fb8ea32c1b7f855dc2a64a78b698130dd/src/bevel/BevelFilter.ts#L82 and then again when Object.assign calls the setter: https://github.com/pixijs/filters/blob/ca0c344fb8ea32c1b7f855dc2a64a78b698130dd/src/bevel/BevelFilter.ts#L125 https://github.com/pixijs/filters/blob/ca0c344fb8ea32c1b7f855dc2a64a78b698130dd/src/bevel/BevelFilter.ts#L133-L137

bigtimebuddy commented 7 months ago

Good catch.