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

dimsuz

08/17/2022, 1:39 PM
Just showing off 😁 This thingie I made recently. Custom
pointerInput
to convert drag gestures into "rotary" input with polar coordinates and custom layout which keeps rotating buttons "upright" (using
Modifier.rotate
wouldn't work here for them). I have made it using "slots": slot for "rotating base" and slot for "button", so it's customizable. Maybe one day turn it into a small lib.
👏🏽 2
👏🏼 2
👏 11
👏🏻 1
👏🏾 1
K 17
jetpack compose 14
🙌🏾 1
🙌 3
t

Tgo1014

08/17/2022, 1:42 PM
Are you planning to open source the code even if it's not exactly a library? I would be curious to take a look at the code 😄
d

dimsuz

08/17/2022, 1:43 PM
I guess it wouldn't be too difficult to upload it to github. I'll post a link here whenever I do it :)
I would also like to add fling handling, currently there's none, but to make it look naturally would be perhaps rather complicated, this involves "physics of a solid rotating body under several forces" 🙂 Of course I could try faking by using fling velocity + some kind of spring/tween to imitate inertia, but it would be interesting to try a more "simulating real world" route.
c

Csaba Szugyiczki

08/17/2022, 1:56 PM
Nice job! 🙂 I know how hard it can be to implement such Modifier, since I implemented basically the same thing in the good old View system. It has fling support, feel free to adopt the code if you feel like it could be of help https://github.com/szugyi/Android-CircleMenu
d

dimsuz

08/17/2022, 1:57 PM
Oh, great, thanks, I will take a look!
c

Colton Idle

08/17/2022, 3:49 PM
🤯 The design looks super cool. Are you using images for that, or drawing all in compose?
d

dimsuz

08/17/2022, 4:07 PM
Unfortunately that's a lot of images layered on top of each other. Designer went wild there. I wish I could do all this with compose, but although this looks almost like doable, it's mostly not. The main problem is using a lot of tricky gradients, especially gradients with blur and custom dash pattern and custom rotation. And also non-standard BlendModes some of which are supported only on recent API versions. But I still plan to revisit that and try as much as I could replace images with code-made gradients, some of them seem doable.
d

dewildte

08/17/2022, 4:44 PM
This looks like something built with Rive.
c

Colton Idle

08/17/2022, 4:50 PM
Ooh. Haven't heard of rive. We've mostly used Lottie for animations but this looks different
5 Views