English | 中文
A Compose Multiplatform library that applies a parallax shift to layered content based on pointer (mouse / touch) position. Each layer can use a different response strategy — linear, inverse, accelerated, or custom.
| Parameter | Default | |
|---|---|---|
modifier |
Modifier |
Outer container modifier |
enterAnimation |
spring() |
Animation on pointer enter |
exitAnimation |
enterAnimation |
Animation on pointer exit |
passThroughPointerEvents |
false |
Propagate events to parent |
content |
— | Builder for layer() calls |
The content block is not @Composable — only layer() is valid inside.
A fun interface mapping normalized pointer position
(x, y each in [-1, 1]) to an Offset.
| Factory | Behavior |
|---|---|
static() |
Always Offset.Zero — fixed reference |
linear(sx, sy) |
Proportional to distance from center |
inverse(sx, sy) |
Opposite direction |
horizontal(s) |
Horizontal axis only |
vertical(s) |
Vertical axis only |
accelerated(sx, sy, power) |
Dramatic near edges |
Custom strategies:
layer(response = { (x, y) ->
Offset(x * 20f, y * 5f)
}) { ... }By default, shifted layers expose the content underneath at the opposite
edges. Set insets to the maximum expected offset to prevent this:
Desktop (JVM) · Android · iOS · Web (JS / WASM)
All platforms use the same API.
Apache License, Version 2.0


