https://kotlinlang.org logo
#compose
Title
# compose
k

Kazemihabib1996

05/16/2020, 5:01 PM
A jetpack compose shimmer effect modifier library https://github.com/kazemihabib/compose-shimmer
👍 14
a

Adam Powell

05/16/2020, 5:05 PM
You don't need to mark modifier factories as
@Composable
when you use the
Modifier.composed {}
builder
being able to omit that and construct modifiers that require composition outside of composition is part of the point of
composed {}
🙂
k

Kazemihabib1996

05/16/2020, 5:22 PM
Oh, thank you, I forgot to remove that after I update to
composed{}
😅
👍 1
a

Adam Powell

05/16/2020, 5:25 PM
I spent part of the morning doing the same updates to my own code 😄
👍 1
r

romainguy

05/16/2020, 6:09 PM
@Kazemihabib1996 Is the
saveLayer()
necessary?
k

Kazemihabib1996

05/16/2020, 6:16 PM
@romainguy Yeah, the result without it:
r

romainguy

05/16/2020, 6:29 PM
you could try to just draw an alpha gradient with a multiply or add blend mode
But yeah if you want to fade out the base content you'll need the layer unfortunately
k

Kazemihabib1996

05/16/2020, 6:41 PM
Yeah, unfortunately, for fade out the base, I need that 😞
@romainguy There isn't any saveLayer in the CanvasScope, and it handles expensive tasks like allocating
Paint
it self. The draw functions of it accept a
blendMode
and we can pass any blendMode to it. So maybe, it should also handle the expensive saveLayer it self some how 🤔🤔 like what you did with Paint. (I'm not sure just the idea came to my mind after you asked about the saveLayer)
r

romainguy

05/16/2020, 6:56 PM
Well saveLayer is expensive not matter who executes it
👍 1
Moving it to CanvasScope wouldn't change anything
k

Kazemihabib1996

05/16/2020, 6:59 PM
Yeah, I was thinking about preventing unnecessary saveLayers. but I don't think it's possible by the way.
4 Views