One Off the Slack: Implementing a Shimmer Effect

Karandeep Singh implemented a shimmer effect, the sort of gradient-based animated shine effect that you see in some UIs. However, Karandeep was not happy with the implementation and asked for advice.

Google’s Leland Richardson went one step further and posted a gist with two implementations of the effect. Unfortunately, his gist previewed an upcoming feature of Compose: the composed function for creating a Modifier. That needs to be converted into a @Composable function for now.

The discussion continued on whether or not @Composable functions can return values. They can — that has been possible since dev03 — though some older documentation has not been updated to reflect this fact. A fair bit of Compose now is in the form of @Composable functions that return values, though typically a @Composable function either renders UI nodes or returns something, usually not both.

Read the original thread in the kotlinlang Slack workspace. Not a member? Join that Slack workspace here!