0Pricing
SwiftUI Academy · Lektion

Lineare, radiale und winkelförmige Farbverläufe

Füllen Sie Views mit fließenden Farbübergängen.

Lineare, radiale und winkelförmige Farbverläufe ist eine kostenlose SwiftUI Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des SwiftUI Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der SwiftUI Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

What Is a Gradient?

A gradient blends smoothly between two or more colors. It adds depth and polish that a flat fill cannot. 🌈

Gradients Are Views Too

Just like Color, a LinearGradient is a view. You can place it directly or use it to fill a shape or background.

Your First LinearGradient

A LinearGradient flows colors along a straight line. Give it colors plus a start and end point to set the direction.

LinearGradient(
    colors: [.blue, .purple],
    startPoint: .top,
    endPoint: .bottom
)

Choosing Start & End Points

Points like .topLeading and .bottomTrailing aim the gradient diagonally. Swap them to change the angle of the blend.

startPoint: .topLeading
endPoint: .bottomTrailing

More Than Two Colors

Pass several colors and the gradient spreads them evenly across its length. Great for sunset-style backgrounds.

LinearGradient(
    colors: [.orange, .pink, .purple],
    startPoint: .leading,
    endPoint: .trailing
)

RadialGradient Glows Outward

A RadialGradient radiates from a center point outward in a circle. It is perfect for spotlights and soft glows.

RadialGradient(
    colors: [.yellow, .red],
    center: .center,
    startRadius: 5,
    endRadius: 120
)

Tuning the Radius

The startRadius and endRadius control how tight or wide the glow spreads. Bigger gaps mean smoother, slower fades.

AngularGradient Sweeps Around

An AngularGradient wraps colors around a center, like a color wheel. It creates a cool conical, swirling effect.

AngularGradient(
    colors: [.red, .green, .blue, .red],
    center: .center
)

Gradient as a Background

Attach a gradient with the background modifier to brighten any view behind your content. Instant visual lift.

Text("Hi")
    .padding()
    .background(LinearGradient(
        colors: [.blue, .cyan],
        startPoint: .top, endPoint: .bottom))

Shorthand Gradients

For a quick blend, call .gradient on any color. SwiftUI builds a subtle top-to-bottom gradient for you instantly.

Circle()
    .fill(Color.blue.gradient)

Pick the Right Gradient

Use linear for directional fades, radial for glows, and angular for wheels. Each gives a different mood to your UI. 🎨

Quick Check

Which gradient sweeps its colors around a center point?

Recap: Gradients

You now blend colors three ways: linear along a line, radial from a center, and angular around a wheel. Beautiful work!

Häufig gestellte Fragen

Ist die Lektion „Lineare, radiale und winkelförmige Farbverläufe“ kostenlos?

Ja — der vollständige Text von „Lineare, radiale und winkelförmige Farbverläufe“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des SwiftUI Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der SwiftUI Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Lineare, radiale und winkelförmige Farbverläufe“?

Füllen Sie Views mit fließenden Farbübergängen. Du übst SwiftUI Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um SwiftUI Academy zu starten?

Keine Vorkenntnisse erforderlich. SwiftUI Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.

Wie lange dauert die Lektion „Lineare, radiale und winkelförmige Farbverläufe“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser SwiftUI Academy-Lektion Code schreiben und ausführen?

Ja. Jede SwiftUI Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Der Typ Color und Asset-Farben
  2. Lineare, radiale und winkelförmige Farbverläufe
  3. Integrierte Formen
  4. Kontur, Füllung und overlay
← Zurück zu SwiftUI Academy