react native library that takes your accelerometer and turns the values into a color
npm install imagination-react-native
npm install imagination-react-native --save
`
$3
You can retrieve the color by passing a function that'll recieve a rgb string whenever the acceleromter updates. It's also good to stop the accelerometer listener when unmounting or so.
`javascript
import {Imagination} from 'imagination-react-native'componentDidMount() {
Imagination.onColorChange( (color) => this.setState({color}) )
}
componentWillUnmount() {
Imagination.stop()
}
`
$3
You can also use the ImaginationWrapper component. It automatically takes care of color changes and stopping. The background color of the component is updated to whatever color the accelerometer represents
`javascript
import {ImaginationWrapper} from 'imagination-react-native'render ():* {
return(
Such colors, amaze, wow
)
}
``