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) | |
setContent { | |
PlaygroundTheme { | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colorScheme.background, | |
) { | |
Box { |
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
private const val NumDots = 5 | |
private const val AnimationDuration = 2000 | |
private const val AnimationSegment = AnimationDuration / 10 | |
private val MainDotSize = 24.dp | |
private val Float.alphaFromRadians: Float | |
get() { | |
val normalized = (this / (2f * PI)).toFloat() | |
return .5f + (normalized - .5f).absoluteValue | |
} |
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
@Stable | |
interface AnimatedDrawerState { | |
var density: Float | |
val drawerWidth: Dp | |
val drawerTranslationX: Float | |
val drawerElevation: Float | |
val backgroundTranslationX: Float | |
val backgroundAlpha: Float |
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
private val TickerCycleMillis = 150 | |
private object AlphabetMapper { | |
private val Alphabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789•".toList() | |
val size: Int = Alphabet.size | |
fun getLetterAt(index: Int): Char = Alphabet[index % size] | |
fun getIndexOf(letter: Char, offset: Int = 0): TickerIndex { |
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
@Stable | |
interface CircularCarouselState { | |
val angle: Float | |
val minorAxisFactor: Float | |
suspend fun stop() | |
suspend fun snapTo(angle: Float) | |
suspend fun decayTo(angle: Float, velocity: Float) | |
fun setMinorAxisFactor(factor: Float) | |
} |
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 MorphingFab(modifier: Modifier = Modifier) { | |
val users = remember { mutableStateListOf<User>() } | |
// 1 | |
var showDialog by remember { mutableStateOf(false) } | |
// 2 | |
SharedTransitionLayout( | |
modifier = Modifier | |
.fillMaxSize(), | |
) { |
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 MorphingFab(modifier: Modifier = Modifier) { | |
val users = remember { mutableStateListOf<User>() } | |
Box(modifier = modifier) { | |
UserList( | |
users = users, | |
modifier = Modifier.fillMaxSize(), | |
) | |
InputBox( |
NewerOlder