Skip to content

Commit ca5a825

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents e0d63ac + 20cbf07 commit ca5a825

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,65 @@ Box(
331331
```
332332
</details>
333333

334+
### AnimatableCardWithText
335+
336+
<img src="https://user-images.githubusercontent.com/50905347/197984698-12536dc4-9a5b-40e1-9627-484738600b60.gif" width="250" height="530">
337+
338+
<details closed>
339+
<summary>State</summary>
340+
<br>
341+
342+
343+
```kotlin
344+
// Simply create shared state and pass it to AnimatableCard and AnimatableText
345+
val animatableCardState = rememberAnimatableCardState(
346+
initialSize = DpSize(width = 50.dp, height = 25.dp),
347+
targetSize = DpSize(width = 300.dp, height = 150.dp),
348+
toTargetSizeAnimationSpec = spring(Spring.DampingRatioHighBouncy, Spring.StiffnessVeryLow),
349+
initialShape = RoundedCornerShape(4.dp),
350+
targetShape = RoundedCornerShape(16.dp),
351+
toTargetShapeAnimationSpec = spring(Spring.DampingRatioHighBouncy, Spring.StiffnessVeryLow),
352+
)
353+
val animatableTextState = rememberAnimatableTextState(
354+
initialFontSize = 4.sp,
355+
targetFontSize = 36.sp,
356+
toTargetFontSizeAnimationSpec = spring(Spring.DampingRatioHighBouncy, Spring.StiffnessVeryLow)
357+
)
358+
val sharedAnimatableState = rememberSharedAnimatableState(
359+
listOf(
360+
animatableCardState,
361+
animatableTextState
362+
)
363+
)
364+
```
365+
</details>
366+
<details closed>
367+
<summary>Component</summary>
368+
<br>
369+
370+
371+
```kotlin
372+
Box(
373+
modifier = Modifier
374+
.fillMaxSize()
375+
.clickable { sharedAnimatableState.animate() },
376+
contentAlignment = Alignment.Center
377+
) {
378+
AnimatableCard(
379+
modifier = Modifier.size(100.dp),
380+
state = sharedAnimatableState
381+
) {
382+
Box(Modifier.fillMaxSize(), Alignment.Center) {
383+
AnimatableText(
384+
text = "Animatable",
385+
state = sharedAnimatableState
386+
)
387+
}
388+
}
389+
}
390+
```
391+
</details>
392+
334393
## Setup
335394
1. Open the file `settings.gradle` (it looks like that)
336395
```groovy

0 commit comments

Comments
 (0)