Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Shivamdhuria/puck
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam Dhuria authored and Shivam Dhuria committed Jan 2, 2022
2 parents c7f7923 + ec9ba8e commit f5f7c03
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Make Composables Draggable.
</p>
</br>
<p align="center">
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/gravity.gif" width="15.3%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/freeform.gif" width="17.5%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/all.gif" width="17.5%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/stickNew.gif" width="16.8%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/towards center.gif" width="18%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/gravity.gif" width="15.3%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/freeform.gif" width="17.5%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/all.gif" width="17.5%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/stickNew.gif" width="16.8%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/towards center.gif" width="18%"/>
</p>

## Including in your project
[![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/balloon.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.skydoves%22%20AND%20a:%22balloon%22)
[![](https://jitpack.io/v/Shivamdhuria/puck.svg)](https://jitpack.io/#Shivamdhuria/puck/0.0.1)
### Gradle
Add below codes to your **root** `build.gradle` file (not your module build.gradle file).
```Gradle
Expand All @@ -26,8 +26,7 @@ allprojects {
And add a dependency code to your **module**'s `build.gradle` file.
```gradle
dependencies {
//pending
implementation
implementation 'com.github.Shivamdhuria:puck:Version'
}
```

Expand Down Expand Up @@ -99,7 +98,7 @@ Currently Puck supports three behaviours
### FreeForm
Freeform makes Composable draggable anywhere in the screen. If the user drags a composable out of screen area, it is coerced within the bounds of the screen.
<p align="start">
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/freeform.gif" width="18%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/freeform.gif" width="18%"/>
</p>

For adding Freeform behaviour to any composable, do -
Expand All @@ -116,7 +115,7 @@ FloatingActionButton(onClick = {},
### Sticky
You can also make Composables stick to the edges or corners of the screen. Simple flick the Composable in the direction you want it to stick and it will follow the trajectory and stick there. To use stick you need to pass a parameter (EDGES, CORNERS,VERTICAL EDGsE HORIZONATL EDGES). Puck will automatically make the set parameter "sticky".
<p align="start">
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/stickNew.gif" width="18%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/stickNew.gif" width="18%"/>
</p>

```kotlin
Expand All @@ -135,7 +134,7 @@ We can define gravity points with center and radius. Any composable that falls w
Note: The circle isn't actualy drawn as above while using puck. I have shown the circle only for demonstration purposes.

<p align="start">
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/gravityN.gif" width="18%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/gravityN.gif" width="18%"/>
</p>

```kotlin
Expand All @@ -155,7 +154,7 @@ FloatingActionButton(onClick = {},
## Attributes
- isPointsTowardsCenter - Currently this only works for Sticky(Edges) mode. Composable will always point towards center by using rotation animation. When a composable is dragged, the rotation value is set to default (0f), after the drag ends and the commposable sticks to any of the edges, the composable rotates according and points towards center.
<p align="center">
<img src="https://github.com/Shivamdhuria/puck/blob/master/assets/towards%20center.gif" width="18%"/>
<img src="https://github.com/Shivamdhuria/puck/blob/main/assets/towards%20center.gif" width="18%"/>
</p>

- animationDuration - This is time taken in milli seconds for the drag animation. The lesser the time the quicker the animation. (Note: When the behaviour is set to Freeform, a composable is draggable without any animation.)
Expand Down

0 comments on commit f5f7c03

Please sign in to comment.