marklovers / kaplay

🦖 A JavaScript game library
https://kaplayjs.com
MIT License
230 stars 14 forks source link

feat: camFlash() #153

Closed amyspark-ng closed 2 weeks ago

amyspark-ng commented 2 weeks ago

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Think it would be cool to have a function to flash the screen, something like camFlash(WHITE, 1) being white the color and 1 the time in seconds it takes to fade out, if this could be done using draw i think i would be able to do it :)

mflerackers commented 2 weeks ago

Isn't that just this?

const flash = add([
  rect(width(), height()),
  color(WHITE),
  opacity(),
  fixed()
])
flash.fadeIn(1).onEnd(destroy(flash))
amyspark-ng commented 2 weeks ago

well yes, if it's dumb feel free to close the issue, just thought it might be a nice built-in feature

mflerackers commented 2 weeks ago

No, no, you can add it. The framework which shall not be named also has it I think.

amyspark-ng commented 2 weeks ago

oh, good, would it be better to do with draw or game object?

mflerackers commented 2 weeks ago

One extra game object is not going to hurt performance.