0Pricing
Jetpack Compose Academy · Lezione

Percorsi, gradienti e modalità di fusione

Crei riempimenti e tratti complessi.

Percorsi, gradienti e modalità di fusione è una lezione Jetpack Compose Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Jetpack Compose Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Jetpack Compose Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

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! ✨

Domande Frequenti

La lezione «Percorsi, gradienti e modalità di fusione» è gratuita?

Sì — il testo completo di «Percorsi, gradienti e modalità di fusione» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Jetpack Compose Academy, passa a CoddyKit PRO. Il corso Jetpack Compose Academy include 4 lezioni in totale.

Cosa imparerò in «Percorsi, gradienti e modalità di fusione»?

Crei riempimenti e tratti complessi. Eserciti Jetpack Compose Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Jetpack Compose Academy?

Non è richiesta alcuna esperienza precedente. Jetpack Compose Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.

Quanto tempo richiede la lezione «Percorsi, gradienti e modalità di fusione»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Jetpack Compose Academy?

Sì. Ogni lezione Jetpack Compose Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. DrawScope: linee, rettangoli e cerchi
  2. Percorsi, gradienti e modalità di fusione
  3. drawWithCache e prestazioni
  4. Creare un anello di avanzamento live
← Torna a Jetpack Compose Academy