i

    iex

    2 years ago
    How to give views an absolute position (want to plot dots on a small graph, for which I'm using
    Box
    / shapes)?
    ah
    Modifier.offset
    apparently
    Adam Powell

    Adam Powell

    2 years ago
    If you're just plotting a graph you'll have a far easier time using
    Canvas {}
    i

    iex

    2 years ago
    I considered it, but is it good for animations (e.g. interpolate between the old and new positions)?
    (with small graph I mean max ~100 points, btw)
    Adam Powell

    Adam Powell

    2 years ago
    yes, state reads in a canvas block are observed just like composition and layout, and if that state changes it will be redrawn without needing to recompose to do it.
    so animating state values or transition values in a canvas composable are just as effective as they are anywhere else
    did something about the shape of the API or docs imply otherwise?
    i

    iex

    2 years ago
    ah, no, just assumptions based on unrelated frameworks 😛
    I'll give canvas a look then, thanks!
    Adam Powell

    Adam Powell

    2 years ago
    If there's some other documentation or emphasis we could add that would have changed those assumptions, please let us know 🙂