Last updated Sep 18, 2026

Invoking the Divine: Crafting a Brahmāstra Loading Animation in Jetpack Compose

In the world of modern Android UI development, a loading screen is more than just a placeholder—it's the first bridge between a user's intent and the app's capability. While a standard circular progress indicator serves its purpose, there are moments when a project demands something... mythical.

Inspired by the celestial energy and legendary power of the Brahmāstra from Indian mythology, I set out to create a custom Jetpack Compose animation that feels less like a wait and more like an invocation.

 


The Vision: A Cosmic Cycle in Kotlin


 

The Brahmāstra isn't just an arrow; it's a manifestation of supreme consciousness. To capture this in Kotlin, I leveraged the declarative UI power of Compose to break the animation into five distinct phases:

  1. 1. The Padma Emergence: A sacred Lotus blooms from the void, representing the birth of divine energy.
  2. 2. Astral Gathering: Rotating celestial energy chakras (Mandala rings) ignite at the core, drawing in cosmic sparks.
  3. 3. Astra Manifestation: The sacred Arrow manifests within the lotus, pulsating as it charges with celestial fire.
  4. 4. The Divine Surge: The Arrow pulls back and launches forward, leaving a trail of radiant light and creating a shockwave that echoes through the cosmic background.
  5. 5. Rebirth: The energy dissipates and returns to the source, ready to be invoked again.

 


The Divine Palette: Modern UX Design


 

Color is the language of energy. For this Android UI design, I moved away from standard Material colors to a custom "Cosmic Palette":

  • 1. Gold & Fiery Orange: The primary heat and radiance of the arrow.
  • 2. Lotus Rose: The delicate yet powerful hue of the blooming petals.
  • 3. Cosmic Teal: The ethereal sparks representing raw astral energy.
  • 4. Deep Cosmic Purple: A background so dark it feels like the edge of the universe.

 


Technical Implementation: The Magic Behind the Canvas


 

Building a high-performance animation requires diving deep into the Jetpack Compose Canvas API. Using a custom Canvas is often more efficient than nested layouts for complex graphics. Here’s a look at how the complexity was managed in Android Studio:

 

1. Master Progress Orchestration with Compose Animation API

 

Using rememberInfiniteTransition, we drive a single progress value from 0f to 1f. This value is then mapped to the specific timing of each phase.

val progress by infiniteTransition.animateFloat(

    initialValue = 0f,

    targetValue = 1f,

    animationSpec = infiniteRepeatable(

        animation = tween(durationMillis = 3600, easing = LinearEasing)

    )

)

 

2. Geometry of the Lotus: Cubic Bezier Curves

 

The petals aren't just triangles; they are drawn using Cubic Bezier curves to give them that organic, tapering look. This is a classic example of using custom graphics in Android to achieve unique brand identities.

val petalPath = Path().apply {

    moveTo(center.x, baseY)

    // Left curve from base to pointed tip

    cubicTo(x1, y1, x2, y2, x3, tipY)

    // Right curve back

    cubicTo(x4, y4, x5, y5, x6, baseY)

    close()

}

 

3. Performance Optimization & Physics

To make the arrow launch feel powerful, I used a FastOutLinearInEasing. By performing all calculations within the DrawScope, we ensure smooth 60fps performance without unnecessary recompositions. The arrow starts slow during the "charging" phase and then accelerates rapidly, accompanied by expanding shockwave rings.

 


Why Custom Android Animations Matter


 

In a sea of standardized UI components, custom animations like the Brahmāstra Loading Indicator create an emotional connection. They tell a story. Whether your user is waiting for a database to sync or a video to process, giving them a moment of visual wonder makes the experience memorable

 

Are you ready to invoke the divine in your next Android project? Let the code be your bow, and your creativity be the arrow.


Keywords: Jetpack Compose, Android UI, Kotlin, Animation, Canvas API, Mobile Design, Brahmastra