Skip to content

Instantly share code, notes, and snippets.

@Ahmed-Sellami
Last active Aug 22, 2021
Embed
What would you like to do?
@Composable
fun Particle(modifier: Modifier, color: Color) {
val radiusDp = dimensionResource(id = R.dimen.particle_radius)
val radius: Float
with(LocalDensity.current) {
radius = radiusDp.toPx()
}
Canvas(modifier.size(radiusDp * 2)) {
drawCircle(
color = color,
radius = radius
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment