GlitchText Compose
A pure Compose Multiplatform library for text rendering with a digital glitch effect and chromatic aberration.
Features
- 🚀 Pure Compose Multiplatform: Supports Android, iOS, Desktop (JVM), and Web (JS & WasmJS).
- 🎨 Chromatic Aberration: Customizable dual-color shift layers (defaults to Cyan & Magenta).
- ⚡ Zero Shader Dependencies: Uses standard Compose Canvas operations (
clipRect, translate, and graphicsLayer).
- 🔄 Temporal Animations: Coroutine-driven random glitch bursts and pauses.
- 🛠️ Customizable: Easily configure amplitude, chromatic colors, text style, and toggle state.
Installation
Add the dependency to your build.gradle.kts:
commonMain.dependencies {
implementation("io.github.eduardomcb:glitchtext:1.0.0")
}
Usage
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp
import androidx.compose.ui.graphics.Color
import io.github.eduardomcb.glitchtext.GlitchText
@Composable
fun DemoGlitch() {
GlitchText(
text = "GLITCH EFFECT",
isGlitching = true,
glitchAmplitude = 6.dp,
color1 = Color(0xFF00FFFF),
color2 = Color()
)
}
License
This project is licensed under the MIT License - see the LICENSE file for details.