Skip to content

A Jetpack Compose Typing Text Animation Library for Android

License

Notifications You must be signed in to change notification settings

zeeshanali-k/Typist

Repository files navigation

Maven Central

Typist

A Jetpack Compose Text Typing Animation Library for Android. For Compose Multiplatform Check this.

Usage

Add this to your project level "build.gradle" or in newer versions of gradle in "settings.gradle" under repositories section:

repositories {
  mavenCentral()
}

Add this to your module level build.gradle file:

implementation 'tech.dev-scion:typist:TAG'

or for kotlin

implementation("tech.dev-scion:typist:TAG")

Replace TAG with library version

Add Typist Composable to your app and configure accordingly:

Typist(
    text = "Hi! I am Typist.",
    modifier = Modifier
                .align(Alignment.Center),
    typistSpeed = TypistSpeed.NORMAL,
    textStyle = TextStyle(
        color = Color.Red,
        fontWeight = FontWeight.Bold,
        fontSize = 28.sp,
        textAlign = TextAlign.Center,
        isBlinkingCursor = true, // if true the cursor will keep blinking
        isInfiniteCursor = false, // if true the cursor will not hide even after the text has been written
        isCursorVisible = true, // if true the cursor will not be visible at all
    ),

    isInfinite = true, // This can make the typing animation repeat infinitely
    onAnimationStart = {},
    onAnimationEnd = {}
)

You can now add multiple strings as follows:

Typist(
        textList = listOf("Hi! I am Typist.","And I can type multiple times"),//These strings will be typed in the specified order
        typistSpeed = TypistSpeed.NORMAL,
        textStyle = TextStyle(
               color = Color.Red,
               fontWeight = FontWeight.Bold,
               fontSize = 28.sp,
               textAlign = TextAlign.Center
        ),
        isInfinite = true, // This can make the typing animation repeat infinitely
        isBlinkingCursor = false,
        isInfiniteCursor = true,
        isCursorVisible = true,
        onAnimationStart = {},
        onAnimationEnd = {}
)