0Pricing
Jetpack Compose Academy · Lesson

Paths, Gradients & Blend Modes

Create complex fills and strokes.

Paths, Gradients & Blend Modes is a free Jetpack Compose Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Jetpack Compose Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Beyond Simple Shapes

Lines and circles are great, but real graphics need curves and rich fills. Meet Path, gradients, and blend modes for that next level.

What Is a Path

A Path is a recorded outline you build point by point. You move and line your way around, then draw the finished shape in one call.

val path = Path()
path.moveTo(0f, 0f)
path.lineTo(100f, 0f)

moveTo and lineTo

Use moveTo to lift the pen to a start point, then lineTo to draw straight segments. Chain them to trace any polygon you like.

path.moveTo(0f, 0f)
path.lineTo(80f, 120f)
path.lineTo(160f, 0f)
path.close()

Curves with quadraticBezierTo

For smooth bends use quadraticBezierTo. A control point pulls the line into a curve, perfect for soft chart edges.

path.quadraticBezierTo(50f, -40f, 100f, 0f)

Draw the Path

Once built, hand the path to drawPath with a color or brush. You can fill it solid or outline it with a Stroke style.

drawPath(path = path, color = Color.Blue)

Meet the Brush

A Brush describes how an area is painted. Instead of a flat color, a brush can pour a smooth gradient across your shape.

Linear Gradients

Use Brush.linearGradient to blend colors along a straight line. Pass a list of colors and watch them fade from one to the next.

val brush = Brush.linearGradient(
    listOf(Color.Cyan, Color.Magenta)
)
drawRect(brush = brush)

Radial Gradients

Reach for Brush.radialGradient to blend outward from a center. It is ideal for spotlights, soft buttons, and glowing orbs.

val glow = Brush.radialGradient(
    listOf(Color.White, Color.Blue)
)

Sweep Gradients

A Brush.sweepGradient rotates colors around a center point. It is the secret behind colorful progress rings and rainbow dials.

val sweep = Brush.sweepGradient(
    listOf(Color.Red, Color.Yellow, Color.Red)
)

Meet Blend Modes

A BlendMode decides how a new shape mixes with what is already drawn. Multiply darkens, Screen lightens, and Plus adds light.

drawCircle(
    color = Color.Yellow,
    blendMode = BlendMode.Multiply
)

Layer for Effects

Blend modes shine when shapes overlap. Stack two translucent circles with BlendMode.Plus and their intersection glows brighter.

Quick Check

Which brush rotates colors around a center point?

Recap

You can now build curves with Path, fill shapes with linear, radial, and sweep gradients, and combine them using blend modes. Time to get creative! ✨

Frequently asked questions

Is the “Paths, Gradients & Blend Modes” lesson free?

Yes — the full text of “Paths, Gradients & Blend Modes” is free to read here on the web, and the Jetpack Compose Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Jetpack Compose Academy course, upgrade to CoddyKit PRO.

What will I learn in “Paths, Gradients & Blend Modes”?

Create complex fills and strokes. You practise Jetpack Compose Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Jetpack Compose Academy?

No prior experience is required. Jetpack Compose Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Paths, Gradients & Blend Modes” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Jetpack Compose Academy lesson?

Yes. Every Jetpack Compose Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. DrawScope: Lines, Rects & Circles
  2. Paths, Gradients & Blend Modes
  3. drawWithCache & Performance
  4. Build a Live Progress Ring
← Back to Jetpack Compose Academy