imagination-react-native

2.0.0 • Public • Published

imagination made with React Native

This is a new way of programming art.

What is imagination?

Imagination for devices takes your accelerometer and turns it into a color. It was created by Matzie for Matzielab as an experimental way of interaction response.

What is it good for?

Nothing and everything! It's basically just a visual response to movement or orientation.

How to use the package

Simply install the package with

npm install imagination-react-native --save

Imagination itself

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.

import {Imagination} from 'imagination-react-native'

componentDidMount() {
  Imagination.onColorChange( (color) => this.setState({color}) )
}

componentWillUnmount() {
  Imagination.stop()
}

ImaginationWrapper component

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

import {ImaginationWrapper} from 'imagination-react-native'

render ():* {
  return(
    <ImaginationWrapper>
      <Text>Such colors, amaze, wow</Text>
    </ImaginationWrapper>
  )
}

Credits

Imagination is an idea by Mathias Eriksson created for Matzielab

Readme

Keywords

none

Package Sidebar

Install

npm i imagination-react-native

Weekly Downloads

2

Version

2.0.0

License

ISC

Unpacked Size

4.2 kB

Total Files

5

Last publish

Collaborators

  • matzie