marklovers / kaplay

🦖 A JavaScript game library

Home Page:https://kaplayjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: camFlash()

amyspark-ng opened this issue · comments

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 :)

Isn't that just this?

const flash = add([
  rect(width(), height()),
  color(WHITE),
  opacity(),
  fixed()
])
flash.fadeIn(1).onEnd(destroy(flash))

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

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

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

One extra game object is not going to hurt performance.