Carter Hudson
Apr 18, 2021

--

I don't think it's very feasible to calculate it based on what he's given. The offset for the first visible item wraps when the offset reaches the item’s height, so you’d have to track a multiplier somehow, and it all gets very messy and complicated. Here's what worked for me:

.graphicsLayer {
lazyListState
.layoutInfo
.visibleItemsInfo
.firstOrNull()
?.offset
?.let { offset ->
alpha = 1.0f + (offset / totalSpannedDistance)
}
}

The offset obtained is in whole number integer pixels, by the way. You’ll need the denominator in your division to be in pixels, preferably a float.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response