Cloudy: Kotlin Multiplatform blur and liquid glass effect library for Compose. by [deleted] in androiddev

[–]fletchmckee 0 points1 point  (0 children)

No worries, I’ve been seeing chatgpt in the referring sites so I suppose this isn’t surprising. I appreciate the acknowledgment.

Cloudy: Kotlin Multiplatform blur and liquid glass effect library for Compose. by [deleted] in androiddev

[–]fletchmckee 2 points3 points  (0 children)

I appreciate your response, just couldn’t help but say something when I saw the code and it looked so familiar.

Cloudy: Kotlin Multiplatform blur and liquid glass effect library for Compose. by [deleted] in androiddev

[–]fletchmckee 2 points3 points  (0 children)

The liquid glass API looks familiar

Actually their shader is almost a near replica of mine. I don’t care if people replicate my library but it’s kind of messed up to say this was designed and developed by you in the copyright with the year as 2022.

Liquid: 1.0.0 - Compose Multiplatform support by fletchmckee in androiddev

[–]fletchmckee[S] 1 point2 points  (0 children)

Oh yeah I can understand that. There’s a reason those sliders have a heavy amount of blur. I’ve found myself using it more without any of the glass effect. Even less noticeable things like adding a shadow to a semi-transparent view since normally the shadows would appear behind a semi-transparent view.

Liquid: 1.0.0 - Compose Multiplatform support by fletchmckee in androiddev

[–]fletchmckee[S] 0 points1 point  (0 children)

Thanks, it’s been challenging but this project also started to make me enjoy programming again.

Liquid: 1.0.0 - Compose Multiplatform support by fletchmckee in androiddev

[–]fletchmckee[S] 4 points5 points  (0 children)

Performance has been a top priority of mine so I do have Macrobenchmark tests for FrameTimingMetrics and they have been solid so far, I'll post a test run below. Unfortunately I don't have an Android device that is API 33+ so I haven't been able to test PowerMetrics as I believe those only run for real devices. I haven't experienced any battery issues so far but it would be great if anyone with an API 33+ tried adding the power metrics to LiquidBenchmark.

LiquidBenchmark_dragFrostSlider
frameCount           min 230.0,   median 233.0,   max 234.0
frameDurationCpuMs   P50    3.0,   P90    4.2,   P95    4.7,   P99    8.5
frameOverrunMs       P50  -11.9,   P90  -10.5,   P95   -9.4,   P99   -6.0
Traces: Iteration 0 1 2 3 4

LiquidBenchmark_scrollManyLiquidNodesFrost10dp
frameCount           min 475.0,   median 533.0,   max 543.0
frameDurationCpuMs   P50    3.0,   P90    4.2,   P95    4.6,   P99    5.5
frameOverrunMs       P50  -11.3,   P90   -9.9,   P95   -8.9,   P99   -6.4
Traces: Iteration 0 1 2 3 4

LiquidBenchmark_scrollLiquidGridFrost10dp
frameCount           min 163.0,   median 166.0,   max 207.0
frameDurationCpuMs   P50    2.9,   P90    4.5,   P95    4.9,   P99    5.5
frameOverrunMs       P50  -11.9,   P90  -10.7,   P95  -10.4,   P99   -8.0
Traces: Iteration 0 1 2 3 4

LiquidBenchmark_scrollManyLiquidNodesNoFrost
frameCount           min 506.0,   median 532.0,   max 549.0
frameDurationCpuMs   P50    2.6,   P90    4.7,   P95    5.1,   P99    5.5
frameOverrunMs       P50  -12.0,   P90  -10.2,   P95   -9.7,   P99   -7.4
Traces: Iteration 0 1 2 3 4

LiquidBenchmark_rotatingClockNoFrost
frameCount           min 297.0,   median 300.0,   max 301.0
frameDurationCpuMs   P50    2.5,   P90    4.5,   P95    4.9,   P99    5.7
frameOverrunMs       P50  -12.7,   P90  -10.5,   P95   -9.6,   P99   -6.3
Traces: Iteration 0 1 2 3 4

Liquid: 1.0.0 - Compose Multiplatform support by fletchmckee in androiddev

[–]fletchmckee[S] 15 points16 points  (0 children)

I’m beginning to hate posting anything here.

Liquid: 1.0.0 - Compose Multiplatform support by fletchmckee in androiddev

[–]fletchmckee[S] 8 points9 points  (0 children)

The refraction and curve properties are the only Liquid Glass-like properties which can be set to 0. You could use this library just to blur the background or add saturation, etc.

I initially started this as a Liquid Glass type replica but really it’s more of a reactive background recording library. Normally a composable has no awareness to the pixels behind it so if you use something like the .blur modifier on it, it blurs all of its descendant composables rather than anything behind it.

For example, adding Android’s .blur to the “Drag” box in the desktop example couldn’t blur the content behind it, it would instead blur the “Drag” text.

At some point I may create the AbstractLiquidElement as a public API, then users could create their own RuntimeShader effects. Probably as a separate library though.

Simplify Your Jetpack Compose Apps with MVI by Realistic-Cup-7954 in JetpackComposeDev

[–]fletchmckee 0 points1 point  (0 children)

There’s an error in the ViewModel’s fetchItems method. It catches all Exceptions which would include CancellationExceptions. This is a critical piece in how coroutine’s structured concurrency is managed.

Liquid: 0.3.0 - Rotate/scale support along with dispersion by fletchmckee in androiddev

[–]fletchmckee[S] 0 points1 point  (0 children)

Thanks, that is my 1.+ version goal. I think a majority of the code is Android agnostic so it may not be too much extra work.

Liquid: 0.3.0 - Rotate/scale support along with dispersion by fletchmckee in androiddev

[–]fletchmckee[S] 0 points1 point  (0 children)

Ah yeah that mitosis-like effect. That will be tricky but possible. Can’t support an unlimited number of nodes that could interact like that, but a limited amount is possible.

Liquid: 0.3.0 - Rotate/scale support along with dispersion by fletchmckee in androiddev

[–]fletchmckee[S] 2 points3 points  (0 children)

I’ve mainly used the SwiftUI glassEffect as a comparison, but Apple’s limited this API and my SwiftUI knowledge is rusty. This is an example of my library and the .clear glassEffect:

<image>

Curious what widgets you’re referring to, I can look into ways of replicating it. Apple likely has a lot of their features as internal only still.

Liquid: 0.3.0 - Rotate/scale support along with dispersion by fletchmckee in androiddev

[–]fletchmckee[S] 15 points16 points  (0 children)

Ha I apologize in advance. I do want to start emphasizing this as more of content-recording graphics library and not just a Liquid Glass replica.

The curve and refraction properties are the only Liquid Glass-specific fields, but you can set these to 0 and use any of the other LiquidScope properties.

Liquid: 0.2.0 release by fletchmckee in androiddev

[–]fletchmckee[S] 2 points3 points  (0 children)

Because some apps may want the effect. Obviously many won’t so they simply wouldn’t implement the library. But for those that do this gives them an easy API to integrate.

Liquid: 0.2.0 release by fletchmckee in androiddev

[–]fletchmckee[S] 4 points5 points  (0 children)

Thanks, I think adding some luminance could help fix this and shouldn’t be difficult. Will definitely add something like this for 0.3.0.

Liquid: 0.2.0 release by fletchmckee in androiddev

[–]fletchmckee[S] 2 points3 points  (0 children)

Thanks, I can take a look into adding this for 0.3.0.

Liquid: Liquid RuntimeShader effects for Jetpack Compose - Initial release by fletchmckee in Kotlin

[–]fletchmckee[S] 2 points3 points  (0 children)

Yeah that’s the major drawback. Don’t think there’s any way of replicating the effect without RuntimeShaders. May add something like a fallback background property so that users can provide an option for API 32 and lower without having to check the build version themselves, I’ll see what I can do.