Skip to content

Instantly share code, notes, and snippets.

@halilozercan
halilozercan / TypingAnimation.kt
Last active November 13, 2024 12:04
TextField Typing Animation
package com.example.textfieldtypinganimation
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
@KlassenKonstantin
KlassenKonstantin / MainActivity.kt
Created August 14, 2024 09:37
AnimatedVisibility overload with target state
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
TheTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
val helloWorld = "Hello World!"
var textOrNull by remember { mutableStateOf<String?>(helloWorld) }
@Composable
fun CardGradient(modifier: Modifier = Modifier) {
Card(
modifier = Modifier.padding(16.dp).fillMaxWidth().aspectRatio(600 / 400f)
.clip(RoundedCornerShape(16.dp))
) {
Gradient()
}
}
@KlassenKonstantin
KlassenKonstantin / AnimatedFocusIndicator.kt
Created May 28, 2024 10:27
Animated focus indicator
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
BorderPathTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Box(
modifier = Modifier
.fillMaxSize()
@vishal2376
vishal2376 / Place.kt
Last active July 31, 2024 10:01
Image Reflection with cool animation using Jetpack Compose
data class Place(
val name: String,
val resId: Int
)
@vishal2376
vishal2376 / FlipAnimation.kt
Created April 25, 2024 17:16
Card Flip Animation using Jetpack Compose
package com.vishal2376.animations.ui.theme
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@JunkFood02
JunkFood02 / Motion.kt
Last active July 19, 2024 11:57
A music player demo made with Jetpack Compose animation APIs, including shared element transition, list animations, animated content, etc.
package com.example.compose_debug
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.Easing
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.PathEasing
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.animation.SharedTransitionLayout
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
@JunkFood02
JunkFood02 / CardExpandContainerTransform.kt
Last active March 24, 2025 19:31
Container transform for cards (🐈 included)
@file:OptIn(
ExperimentalSharedTransitionApi::class,
ExperimentalMaterial3Api::class
)
package com.example.compose_debug
import android.util.Log
import androidx.activity.compose.BackHandler
import androidx.annotation.DrawableRes
@KlassenKonstantin
KlassenKonstantin / SharedTrans.kt
Last active April 29, 2025 17:09
Popup shared transition test
private val products = listOf(
Product("🍎", "Apples"),
Product("🍪", "Cookies"),
Product("🍉", "Watermelon"),
Product("🫐", "Blueberries"),
Product("🍊", "Oranges"),
Product("🍑", "Peaches"),
Product("🥦", "Broccoli"),
)