https://github.com/agilie/interfaceinteraction
Interact your app's interface elements with different effects!
https://github.com/agilie/interfaceinteraction
accelerometer animation gravity interface kotlin kotlin-android physics shake
Last synced: 8 months ago
JSON representation
Interact your app's interface elements with different effects!
- Host: GitHub
- URL: https://github.com/agilie/interfaceinteraction
- Owner: agilie
- License: mit
- Created: 2017-06-27T07:21:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-25T12:13:07.000Z (over 8 years ago)
- Last Synced: 2025-05-07T10:51:53.696Z (9 months ago)
- Topics: accelerometer, animation, gravity, interface, kotlin, kotlin-android, physics, shake
- Language: Kotlin
- Homepage: https://agilie.com
- Size: 340 KB
- Stars: 57
- Watchers: 9
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Influenced with [PhysicsLayout](https://github.com/Jawnnypoo/PhysicsLayout) project, we've implemented an interesting animation. Our library captures any interface (screen or view) and throws its UI elements over under the influence of gravity, so that one can move them from side to side obliquely. Gravity depends on device's [accelerometer data](https://developer.android.com/reference/android/hardware/SensorManager.html). Call *stop()* method to return all the UI elements to their original location.
Another option is to apply _shake_ animation for your UI elements.
These animations can be easily used during the development of any application as an event activated after a specified user action.
### Gravity
### Shake

## Example
### How does it work?
__Gravity:__
First, create an instance of *GravityControllerImpl*. Pass context instance and root *ViewGroup* as constructor parameters:
````kotlin
val gravityController = GravityControllerImpl(this, rootLayout)
````
To initiate gravity animation of all subviews (except ViewGroup instances) and then return back these UI elements simply call appropriate methods:
````kotlin
gravityController.start()
gravityController.stop()
````
__Shake:__
Choose what you want to shake: all activity or only view. Then you need to build your ShakeBuilder, call the method *shake* where the parameter is yours view and in the end call the method *build*.
````kotlin
val shaker = InterfaceInteractorImpl().shake(this).build()
````
In order to start animation you need to call the method *shakeMyActivity* or *shakeMyView*. To complete the animation call the method *stopAnimation*
````kotlin
shaker.shakeMyActivity()
shaker.shakeMyView()
shaker.stopAnimation()
````
## Usage
### Gradle
Add dependency in your `build.gradle` file:
````gradle
compile 'com.agilie:interface-interaction:1.0'
````
### Maven
Add rependency in your `.pom` file:
````xml
com.agilie
interface-interaction
1.0
pom
````
## Requirements
AGMobileGift works on Android API 19+
## Troubleshooting
Problems? Check the [Issues](https://github.com/agilie/AGMobileGift/issues) block
to find the solution or create an new issue that we will fix asap.
## Author
This library is open-sourced by [Agilie Team](https://www.agilie.com?utm_source=github&utm_medium=referral&utm_campaign=Git_Android_Kotlin&utm_term=InterfaceInteraction)
## Contributors
- [Eugene Surkov](https://github.com/ukevgen)
## Contact us
If you have any questions, suggestions or just need a help with web or mobile development, please email us at
You can ask us anything from basic to complex questions.
We will continue publishing new open-source projects. Stay with us, more updates will follow!
## License
The [MIT](LICENSE.md) License (MIT) Copyright © 2017 [Agilie Team](https://www.agilie.com?utm_source=github&utm_medium=referral&utm_campaign=Git_Android_Kotlin&utm_term=InterfaceInteraction)