dirty initial commit
This commit is contained in:
commit
2351c93677
24 changed files with 2203 additions and 0 deletions
22
game/Color.js
Normal file
22
game/Color.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export function tint(c, f) {
|
||||
return [
|
||||
Math.max(0, Math.min(255, Math.round((255 - c[0]) * f))),
|
||||
Math.max(0, Math.min(255, Math.round((255 - c[1]) * f))),
|
||||
Math.max(0, Math.min(255, Math.round((255 - c[2]) * f))),
|
||||
c[3]
|
||||
]
|
||||
}
|
||||
|
||||
export function shade(c, f) {
|
||||
return [
|
||||
Math.max(0, Math.min(255, Math.round(c[0] * f))),
|
||||
Math.max(0, Math.min(255, Math.round(c[1] * f))),
|
||||
Math.max(0, Math.min(255, Math.round(c[2] * f))),
|
||||
c[3]
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
tint,
|
||||
shade
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue