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
val titleXFirstInterpolatedPoint = lerp( | |
titlePaddingStart, | |
(titlePaddingEnd - titleExtraStartPadding) * 5 / 4, | |
collapseFraction | |
) | |
val titleXSecondInterpolatedPoint = lerp( | |
(titlePaddingEnd - titleExtraStartPadding) * 5 / 4, | |
titlePaddingEnd - titleExtraStartPadding, | |
collapseFraction |
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
val titleExtraStartPadding = titleWidthPx.toDp() * (1 - scaleXY.value) / 2 |
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
. | |
. | |
Text( | |
text = "New York", | |
fontSize = 30.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier | |
.graphicsLayer { | |
val collapseRange: Float = (headerHeightPx - toolbarHeightPx) | |
val collapseFraction: Float = (scroll.value / collapseRange).coerceIn(0f, 1f) |
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 titleFontScaleStart = 1f | |
private const val titleFontScaleEnd = 0.66f | |
@Composable | |
private fun Title(scroll: ScrollState, headerHeightPx: Float, toolbarHeightPx: Float) { | |
val collapseRange: Float = (headerHeightPx - toolbarHeightPx) | |
val collapseFraction: Float = (scroll.value / collapseRange).coerceIn(0f, 1f) | |
val scaleXY = lerp( | |
titleFontScaleStart.dp, | |
titleFontScaleEnd.dp, |
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
. | |
. | |
Text( | |
text = "New York", | |
fontSize = 30.sp, | |
fontWeight = FontWeight.Bold, | |
modifier = Modifier | |
.graphicsLayer { | |
translationY = titleY.toPx() | |
translationX = titleX.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
val titleX = lerp( | |
titleXFirstInterpolatedPoint, | |
titleXSecondInterpolatedPoint, | |
collapseFraction | |
) |
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
val titleXSecondInterpolatedPoint = lerp( | |
titlePaddingEnd * 5 / 4, | |
titlePaddingEnd, | |
collapseFraction | |
) |
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
val titleXFirstInterpolatedPoint = lerp( | |
titlePaddingStart, | |
titlePaddingEnd * 5 / 4, | |
collapseFraction | |
) |
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
val titleY = lerp( | |
titleYFirstInterpolatedPoint, | |
titleYSecondInterpolatedPoint, | |
collapseFraction | |
) |
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
val titleYSecondInterpolatedPoint = lerp( | |
headerHeight / 2, | |
toolbarHeight / 2 - titleHeightDp / 2, | |
collapseFraction | |
) |
NewerOlder