Thread
#compose
    Mehdi Haghgoo

    Mehdi Haghgoo

    1 year ago
    What is wrong with this animation? It is supposed to change size to 100.dp when clicked but does nothing.
    val size1 = animate(300.dp)
    val size2 = animate(100.dp)
    
    var aSize by mutableStateOf(size1)
    Image(vectorResource(id = R.drawable.video), modifier = Modifier.size(aSize).clickable(onClick = { aSize = size2 }).background(Color.Red))
    gildor

    gildor

    1 year ago
    it doesn’t look right for me how you use mutableStateOf (no remeber) and just general approach
    it should be something like:
    var isClicked by remember { mutableStateOf(false) }
    val size = animate(if (isClicked) 300.dp else 100.dp)
    
    
    Image(vectorResource(id = R.drawable.video), modifier = Modifier.size(size).clickable(onClick = { isClicked = true }).background(Color.Red))