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

Particles' alpha value "wraps" if greater than 1 (ex. 1.7 behaves like 0.7) #6551

Closed
orcomarcio opened this issue Jul 19, 2023 · 2 comments
Closed

Comments

@orcomarcio
Copy link

orcomarcio commented Jul 19, 2023

Version

  • Phaser Version: 3.60
  • Operating system: Windows 11
  • Browser: Chrome

Description

When giving particles an alpha greater than 1, the applied alpha is wrapped. For example, if a particle has alpha 1.5 it shows on screen as if it had alpha 0.5. This behaviour is not mirrored by other objects like sprites.
The value doesn't wrap the other way around (-0.5 shows as 0 for example).

If you wonder why that creates problems for me, I often key alpha with out of bounds values to manipulate the timings, for example if want something to finish fading in half way through the tween i will set value like this alpha: { from: 0, to: 2 }

I think i can use an Interpolation Object instead now in 3.6, but I though this might be of interest since it doesn't aling with how alpha works with normal objects.

Example Test Code

image

In this particular example particles fade in 3 times.

Additional Information

P.S. I tried using an Interpolation Object and it works, although in the documentation it says that by default interpolation is linear, but if I dont declare it it doesn't work.
image

Works:
image

Doesn't work:
image

photonstorm added a commit that referenced this issue Jul 21, 2023
…x: { values: [ 50, 500, 200, 800 ] }` it would fail to set the final value unless you specified the `interpolation` property as well. It now defaults to `linear` if not given. Fix #6551
@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

@orcomarcio
Copy link
Author

Tested and it works propery now thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants