🤵♂️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun FlipActionScreen() { | |
var flippedState by remember { mutableStateOf(false) } | |
val rotationY by animateFloatAsState( | |
targetValue = if (flippedState) 180f else 0f, | |
animationSpec = spring( | |
dampingRatio = Spring.DampingRatioHighBouncy, | |
stiffness = Spring.StiffnessVeryLow | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.chootadev.composetryout | |
import androidx.annotation.DrawableRes | |
import androidx.compose.animation.core.animateFloatAsState | |
import androidx.compose.animation.core.keyframes | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.border | |
import androidx.compose.foundation.clickable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//settings.gradle.kts | |
dependencyResolutionManagement { | |
repositories { | |
maven { url = uri("https://androidx.dev/snapshots/builds/11670047/artifacts/repository/") } | |
google() | |
mavenCentral() | |
maven(url = "https://plugins.gradle.org/m2/") | |
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun MetaballEffect() { | |
var targetAngle by remember { mutableStateOf(0f) } | |
val animatedAngle by animateFloatAsState( | |
targetValue = targetAngle, | |
animationSpec = tween(durationMillis = 1000) | |
) | |
var toggle by remember { mutableStateOf(false) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun InteractiveCanvas(maxWidth: Int, maxHeight: Int) { | |
val random = remember { Random.Default } | |
var touchPosition by remember { mutableStateOf(Offset.Unspecified) } | |
val heartSize = 75F | |
val heartPath = createHeartPath(heartSize) | |
val heartOffsets = remember { mutableStateListOf<Offset>() } | |
val heartColors = remember { mutableStateListOf<Color>() } | |
if (heartOffsets.isEmpty()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun DraggableLineDrawing() { | |
Box(modifier = Modifier.fillMaxSize()) { | |
val buttonSize = 50.dp | |
val buttonRadius = buttonSize.value / 2 | |
val buttonsState = remember { List(10) { mutableStateOf(Offset.Zero) } } | |
val explodedState = remember { mutableStateListOf<Boolean>().apply { repeat(10) { add(false) } } } | |
val secondaryColor = MaterialTheme.colorScheme.secondary | |
val brush = Brush.horizontalGradient(listOf(Color.Red, Color.Blue)) | |
val brushSecond = Brush.horizontalGradient(listOf(Color.Gray, Color.Black)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
enableEdgeToEdge() | |
setContent { | |
TicTacToeGameTheme { | |
TicTacToeGame() | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun AnimatedHeartShape() { | |
BoxWithConstraints( | |
modifier = Modifier.fillMaxSize(), | |
contentAlignment = Alignment.Center | |
) { | |
var clicked by remember { mutableStateOf(false) } | |
val heartSize = 400.dp | |
val heartSizePx = with(LocalDensity.current) { heartSize.toPx() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun FlipCard() { | |
var rotationXDegrees by remember { mutableStateOf(0f) } | |
var rotationYDegrees by remember { mutableStateOf(0f) } | |
val rotationX by animateFloatAsState( | |
targetValue = rotationXDegrees, | |
animationSpec = tween(durationMillis = 1000) | |
) | |
val rotationY by animateFloatAsState( | |
targetValue = rotationYDegrees, |
NewerOlder