Colton Idle
03/19/2021, 4:59 PMColton Idle
03/19/2021, 5:01 PMColton Idle
03/19/2021, 5:01 PMColton Idle
03/19/2021, 5:16 PMDoris Liu
03/19/2021, 5:50 PMAnimatedVector
and Lottie
may both be an overkill for this, since it's just drawing two lines. Here's an example of drawing the two lines with Canvas using animate
(now renamed to animate*AsState): https://gist.github.com/pt2121/3fa9e0e3e2659171102d752b33d1b1c7#file-expandcollapsebutton-kt-L96Doris Liu
03/19/2021, 5:53 PMAlexjlockwood
03/19/2021, 5:55 PMColton Idle
03/19/2021, 5:58 PMhttps://raw.githubusercontent.com/hearsilent/PixelSlide/master/screenshots/screenrecord.gif▾
Alexjlockwood
03/19/2021, 6:02 PMColton Idle
03/19/2021, 6:02 PMColton Idle
03/19/2021, 6:55 PMPathNode.MoveTo(
lerp(from.x, to.x, t),
lerp(from.y, to.y, t),
)
MoveTo seems to have been updated to take a float instead of list of pathNodes and I'm not sure how to proceed.Doris Liu
03/19/2021, 7:53 PMMoveTo
in your snippet should work - PathNode.MoveTo
takes two floats and you have two floats from lerpingColton Idle
03/19/2021, 9:57 PM-"two floats from lerping" I still don't know what lerping does, but it returns a list of Path nodes? And so this is the compile error I get:takes two floats and you have two floats from lerpingPathNode.MoveTo
Type mismatch.
Required:
Float
Found:
List<PathNode>
Colton Idle
03/19/2021, 10:02 PMlerp
is an actual method that comes from other packages? I guess maybe thats the issue. Will try playing around with imports.Colton Idle
03/19/2021, 10:06 PMColton Idle
03/20/2021, 12:33 AMIcon(
contentDescription = null,
painter = rememberVectorPainter(
tintColor = MyTheme.colors.red,
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f,
) { _, _ ->
Path(
pathData = morphedPathNodes,
strokeLineCap = StrokeCap.Round,
fill = SolidColor(MyTheme.colors.red),
)
},
modifier = modifier
)
Doris Liu
03/20/2021, 3:36 AManimationSpec
parameter in animateTo
. If you need to manually set the progress, consider snapping the progress with Animatable.snapTo(..)
Re 2: Icon
has a default tinting that you'll need to overwrite: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]src/commonMain/kotlin/androidx/compose/material/Icon.kt;l=116Albert Chang
03/20/2021, 12:38 PMlerp
function you were looking for should be this and you need to add androidx.compose.ui:ui-util
to your dependencies to use it.Colton Idle
03/20/2021, 5:56 PM