diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-03-29 00:35:56 -0700 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-03-29 00:35:56 -0700 |
commit | 65220cc8db0d7c63f49627526466d54969958fe1 (patch) | |
tree | e2989cb16576f177e60f75f9a733487adfd868f5 /readme.md | |
parent | 51687fe7a2de2d4ed2800af46f9b6a9ac6c929ee (diff) |
Init commit
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..6023f23 --- /dev/null +++ b/readme.md @@ -0,0 +1,15 @@ +# useSunlight + +A React hook for the current level of sunlight on an integer scale from `[0,10]`. Solar altitudes in the range `[0, PI]` are mapped to their height above the horizon on the unit circle (scaled up by 10), and all range below the horizon (`[PI, 2PI]`) are mapped to zero. + +## Usage + +```javascript +// src/demo-component.js +export const DemoComponent = ({ children }) => { + const [sunlight] = useSunlight() + const theme = sunlightToTheme(sunlight) + const style = sunlightToStyle(theme) + return <div style={style}>{children}</div> +} +``` |