Stardust is a high-performance Compose Multiplatform library for rendering animated, static, and Bézier mesh gradients with procedural film grain across Android, iOS, Desktop/JVM, and Web. Inspired by SwiftUI's MeshGradient, Stardust completely eliminates low-level frame loop boilerplate, providing intuitive, clean composables alongside zero-allocation GPU shaders.
Create a fluid, continuously flowing mesh gradient with zero setup math or manual VSYNC frame loops:
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import io.github.quantum3600.stardust.AnimatedStardustMesh
@Composable
fun FlowingMeshBackground() {
AnimatedStardustMesh(
colors = listOf(
Color(0xFFF36E21), Color(0xFFF0A92A),
Color(0xFF36447C), Color(0xFF2D1137)
),
width = 3,
height = 3,
speed = 0.15f, // Mesh motion speed (set to 0f to pause)
wobbleAmount = 0.12f, // Motion amplitude/randomness
dustIntensity = 0.05f, // Procedural film grain intensity
modifier = Modifier.fillMaxSize()
)
}For smooth, organic curves and dynamic tangent handle warping:
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import io.github.quantum3600.stardust.AnimatedBezierStardustMesh
@Composable
fun OrganicBezierMesh() {
AnimatedBezierStardustMesh(
colors = listOf(Color.Cyan, Color.Magenta, Color.Blue, Color.Yellow),
width = 3,
height = 3,
speed = 1.0f,
randomness = 0.18f,
dustIntensity = 0.10f,
modifier = Modifier.fillMaxSize()
)
}Pass explicit point positions or 2D grid lists for static layouts:
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import io.github.quantum3600.stardust.StardustMesh
@Composable
fun StaticMesh() {
StardustMesh(
width = 2,
height = 2,
points = arrayOf(
Offset(0f, 0f), Offset(1f, 0f),
Offset(0f, 1f), Offset(1f, 1f)
),
colors = arrayOf(
Color(0xFFF09819), Color(0xFFEDDE5D),
Color(0xFF8A2387), Color(0xFFE94057)
),
dustIntensity = 0.08f,
modifier = Modifier.fillMaxSize()
)
}For interactive drag gestures, physics, or manual point snapping:
import io.github.quantum3600.stardust.StardustMesh
import io.github.quantum3600.stardust.rememberStardustMeshState
@Composable
fun InteractiveMesh(points: Array<Offset>, colors: Array<Color>) {
val meshState = rememberStardustMeshState(points, colors)
StardustMesh(
width = 3,
height = 3,
state = meshState,
dustIntensity = 0.05f,
modifier = Modifier.fillMaxSize()
)
}Apply procedural film grain texture directly over any Compose component (Cards, Buttons, Images, Text):
import androidx.compose.ui.graphics.BlendMode
import io.github.quantum3600.stardust.stardust
Card(
modifier = Modifier
.fillMaxWidth()
.stardust(
intensity = 0.08f,
seed = animTime,
blendMode = BlendMode.Overlay
)
) {
Text("Tactile Grain Overlay", modifier = Modifier.padding(16.dp))
}Add Stardust to your module's build.gradle.kts from Maven Central:
dependencies {
implementation("io.github.quantum3600:stardust:1.0.5-alpha01")
}- Intuitive Composables: Single-line calls for animated, static, and Bézier mesh gradients.
- Unified Parameters: Consistent parameter names (
colors,speed,dustIntensity,wobbleAmount,randomness). - Zero Allocation VSYNC Engine: Continuous frame animation loop runs with zero heap allocations or recomposition passes.
- Automatic Spatial Grid Colors: Pass 4 corner colors to automatically blend rich 2D multi-directional gradients across any grid size.
- Cross-Platform GPU Performance: Native AGSL shaders on Android API 33+, OpenGL ES hardware buffers on Android API 26-32, and Skia SkSL
RuntimeEffecton iOS, Desktop, JS, and Wasm.

