Skip to content

Instantly share code, notes, and snippets.

View mbakgun's full-sized avatar

Burak Akgün mbakgun

View GitHub Profile
@mertceyhan
mertceyhan / TypewriterTextEffect.kt
Created May 8, 2023 13:54
TypewriterTextEffect: A customizable Jetpack Compose function that reveals text with a typewriter-like effect, one chunk at a time
/**
* A composable function that displays a text with a typewriter-like effect, revealing characters in chunks.
*
* @param text The input text to be displayed with the typewriter effect.
* @param minDelayInMillis The minimum delay in milliseconds between revealing character chunks, defaults to 10ms.
* @param maxDelayInMillis The maximum delay in milliseconds between revealing character chunks, defaults to 50ms.
* @param minCharacterChunk The minimum number of characters to reveal at once, defaults to 1.
* @param maxCharacterChunk The maximum number of characters to reveal at once, defaults to 5.
* @param onEffectCompleted A callback function invoked when the entire text has been revealed.
* @param displayTextComposable A composable function that receives the text to display with the typewriter effect.