karandeep singh
05/02/2020, 7:20 PMZach Klippenstein (he/him) [MOD]
05/02/2020, 8:49 PMLeland Richardson [G]
05/02/2020, 9:01 PMromainguy
05/02/2020, 9:42 PMisAntiAlias
isAntiAliased
, sure; hasAntiAliasing
, sure; antiAlias/ing
, sureisAntiAlias
, 🙅android.graphics
) accept a local transform as a Matrix
which you can setTranslate(x,y)
on every frame. If you set the shader’s tile mode to CLAMP
you’re good to goLeland Richardson [G]
05/02/2020, 9:48 PMkarandeep singh
05/03/2020, 5:44 PMfun Modifier.shimmer() = composed {
val progress = animatedFloat(0f)
onActive {
progress.loop(0f, 1f, 1000)
onDispose {
progress.stop()
}
}
remember { ShimmerModifier(progress) }
}
Zach Klippenstein (he/him) [MOD]
05/03/2020, 6:22 PMkarandeep singh
05/03/2020, 6:27 PMLeland Richardson [G]
05/03/2020, 6:55 PM@Composable fun Modifier.shimmer() = …
insteadcomposed
is better for two primary reasons:
1. it means you can create and hold on to the reference of the modifier in a non-composable scope, which is important
2. it means that the composable state that it uses will be 1:1 with the layout nodes that it is modified to. This means that if you apply the modifier to several different layout nodes, it will have independent state for each onekarandeep singh
05/03/2020, 6:59 PMLeland Richardson [G]
05/03/2020, 7:30 PMkarandeep singh
05/03/2020, 7:33 PMFunctions which invoke @Composable functions must be marked with the @Composable annotation
@Composable
fun Modifier.shimmer() = {
val progress = animatedFloat(0f)
onActive {
progress.loop(0f, 1f, 1000)
onDispose {
progress.stop()
}
}
remember { ShimmerModifier(progress) }
}
Zach Klippenstein (he/him) [MOD]
05/03/2020, 7:53 PMshimmer() {
, not shimmer() = {
. And then add a return
before remember
.karandeep singh
05/03/2020, 7:55 PMZach Klippenstein (he/him) [MOD]
05/03/2020, 7:56 PMcomposed
is a composable function, and it's returning that modifier. Basically you're just removing one layer of indirection.karandeep singh
05/03/2020, 8:02 PMZach Klippenstein (he/him) [MOD]
05/03/2020, 8:10 PM+
syntax for effects was deprecated, in dev05 or some time around then I think? Look at that source link I posted, the function parameter to composed
is a composable function that returns a Modifier
.karandeep singh
05/03/2020, 8:19 PMLeland Richardson [G]
05/03/2020, 10:34 PMremember
and state
etc are pretty fundamental components to compose overallKazemihabib1996
05/08/2020, 8:52 PMModel
class:
Composable functions which directly or indirectly read properties of the model class, the composables will be recomposed whenever any properties of the the model are written to.
but ContentDrawScope.draw()
is not a Composable function, why does it recompose whenever progress is being updated?Leland Richardson [G]
05/08/2020, 8:59 PMKazemihabib1996
05/08/2020, 9:00 PM