From ab852abeb110f3752271837947c0777ff0c504c1 Mon Sep 17 00:00:00 2001 From: stitch <66770613+taewooyo@users.noreply.github.com> Date: Sat, 18 Nov 2023 13:06:44 +0900 Subject: [PATCH] Update README file --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/README.md b/README.md index f06e205..39d69d4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,74 @@

+ +## Shaker in Jetpack Compose + +If you want to use Shaker in your Jetpack Compose project, check out the **[Shaker in Jetpack Compose](https://github.com/taewooyo/Shaker#shaker-in-jetpack-compose-1)** guidelines. + +## How to Use + +Shaker supports Kotlin projects, so you can reference it by your language. + +All you need to do is call the composable function rememberShaker, throw ShakerConfiguration data through the shaker function to determine which action to use, and pass it as an argument to the shaker in the Modifier. + +```kotlin +val shakeState = rememberShakerState() +Box( + modifier = Modifier + .shaker(shakeState) + .padding(15.dp) + .clip(RoundedCornerShape(30.dp)) + .clickable { + shakeState.shaker( + ShakerConfiguration( + iterations = 1, + stiffness = 400f, + translateX = 50f, + translateY = -50f, + ), + ) + }, + contentAlignment = Alignment.Center, +) { + Text(text = "Example Button", color = Color.White) +} +``` + +## Shaker in Jetpack Compose + +Shaker allows you to display scale, rotate, translate animation in Jetpack Compose easily. + +![Maven Central](https://img.shields.io/maven-central/v/io.github.taewooyo/shaker) + +Add the dependency below to your **module**'s `build.gradle` file + +```build.gradle +dependencies { + implementation "io.github.taewooyo:shaker:${version}" +} +``` + +### Shaker Configuration + +Shaker Configuration allows you to set the number of repetitions, rotation angle, direction of rotation, direction of movement, enlargement, reduction, and intensity. + +```kotlin +public data class ShakerConfiguration( + val iterations: Int = 0, + val stiffness: Float = 100_000f, + val rotate: Float = 0f, + val rotateX: Float = 0f, + val rotateY: Float = 0f, + val scaleX: Float = 0f, + val scaleY: Float = 0f, + val translateX: Float = 0f, + val translateY: Float = 0f, + val trigger: Long = System.currentTimeMillis(), +) +``` + + # License ```xml