Skip to content

NSLand/AnimatedMesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌀 AnimatedMesh

Dynamic, themeable, and fully SwiftUI-powered animated mesh gradients.
Add motion and color depth to your app’s backgrounds with ease.

Swift Platforms License SwiftUI


✨ Overview

AnimatedMesh brings live, evolving color gradients to SwiftUI using the new MeshGradient API.
It’s lightweight, theme-based, and completely customizable — perfect for creating ambient motion backgrounds, onboarding screens, and modern Apple-style visuals.

Think App Store icons, Apple Music auroras, or macOS Sonoma wallpapers — but made interactive and code-driven.


🧱 Installation

Swift Package Manager

In Xcode:

  1. Go to File ▸ Add Packages...
  2. Enter the URL:
    https://github.com/nsland/AnimatedMesh
    
  3. Choose Add Package

Or manually in your Package.swift:

dependencies: [
    .package(url: "https://github.com/nsland/AnimatedMesh", from: "1.0.0")
]

Then import it:

import AnimatedMesh

🧭 Usage

Basic Example

import SwiftUI
import AnimatedMesh

struct ContentView: View {
    var body: some View {
        ZStack {
            AnimatedMesh(theme: .auroraBlush)
                .ignoresSafeArea()
            
            VStack {
                Text("Hello, Mesh!")
                    .font(.largeTitle)
                    .bold()
                    .foregroundStyle(.white)
            }
        }
    }
}

Custom Theme Example

let customTheme = MeshGradientColorTheme(
    width: 4,
    height: 4,
    meshColors: [
        .blue, .purple, .cyan, .blue,
        .purple, .cyan, .blue, .purple,
        .cyan, .blue, .purple, .cyan,
        .blue, .purple, .cyan, .blue
    ]
)

Use it like this:

AnimatedMesh(theme: customTheme)

🎨 Built-in Themes

Theme Description
.auroraBlush Soft pinks, purples, and peaches for glowing backgrounds
.dreamyPurple Serene lavender tones for calm, sleep-inspired UIs
.moonlitViolet Deep blue-violet hues of a moonlit sky
.twilightFlow Subtle purple gradients for elegant dark designs
.auroraSleep Soothing purple and teal blend for tranquil animations
.deepRest Muted purples for meditative or sleep apps
.lavenderDream Gentle spa-like lavender tones
.sunnyGold Bright golden and yellow hues for cheerful UIs
.sunsetGlow Warm sunset reds and pinks
.vibrantFlow Bold and dynamic palette for playful designs

⚙️ Customization

You can easily adjust:

  • width and height → number of mesh grid columns/rows
  • meshColors → base colors of your theme

You can even create your own dynamic logic:

extension MeshGradientColorTheme {
    static let oceanBreeze = MeshGradientColorTheme(
        width: 3,
        height: 3,
        meshColors: [.blue, .teal, .mint, .cyan, .indigo, .blue, .mint, .cyan, .teal]
    )
}

🪄 Accessibility

AnimatedMesh is purely decorative.
If used as a background, mark it as hidden from accessibility:

.accessibilityHidden(true)

💡 Requirements

Platform Minimum Version
iOS 18.0
macOS 15.0
tvOS 18.0
visionOS 2.0
watchOS 11.0
  • Requires Swift 6.2 or later
  • Uses SwiftUI’s native MeshGradient API

📸 Preview

Animated Mesh Gradient Preview


📄 License

Licensed under the MIT License.
See LICENSE for details.

About

Dynamic, themeable, and fully SwiftUI-powered animated mesh gradients

Topics

Resources

License

Stars

5 stars

Watchers

0 watching

Forks

Contributors

Languages