Last active
May 30, 2020 09:08
-
-
Save jniac/5e31fb66cf2569a85457988de3a9cac4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ScreenScalar(props = { p1:1, p2:1 }) { | |
const compute = () => this.value = 1 - Object.values(props).reduce((r, v) => r * (1 - v), 1) | |
compute() | |
for (const key of Object.keys(props)) { | |
Object.defineProperty(this, key, { | |
get: () => props[key], | |
set: value => { | |
props[key] = value | |
compute() | |
}, | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Screen" aka the blend mode
value === 0 if every prop values are 0
usage