Skip to content
ํ”„๋กœ์ ํŠธ

์†Œ๊ฐœ

๐ŸŽจ Instagram๊ณผ ๊ฐ™์€ ๊ทธ๋ผ๋ฐ์ด์…˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ

๋””์ž์ธ ๋ฐ ๋ฏธ๋””์–ด

์ด ์ˆ˜์น˜๋ฅผ ์ธก์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

์ธก์ •๋œ ์Šคํƒ€ ์ฆ๊ฐ€

in 24h
0
in 7 days
0
in 15 days
-1
in 1 month
-1

์„œ๋กœ ๊ฒน์น˜๋Š” ๊ธฐ๊ฐ„์˜ ์ˆœ์ฆ๊ฐ€๋Ÿ‰์ด๋ฉฐ ์ผ๋ณ„ ํ•ฉ๊ณ„๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์ธก์ •๊ฐ’์ด ์—†์œผ๋ฉด ๋น„์›Œ ๋‘ก๋‹ˆ๋‹ค. ์Šคํƒ€๋Š” ๊ด€์‹ฌ๋„๋ฅผ ๋‚˜ํƒ€๋‚ด๋ฉฐ ํ’ˆ์งˆ์„ ๋ณด์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

README.md

Original

Pastel

๐ŸŽจ Gradient animation effect like Instagram

Swift Version License Platform SPM compatible

pastel_01.gif pastel_02.gif pastel_03.gif

Requirements

  • iOS 16.0+
  • Swift 5.9+
  • Xcode 15+

Installation

Swift Package Manager

Add Pastel to your Package.swift:

dependencies: [
    .package(url: "https://github.com/cruisediary/Pastel.git", from: "1.0.0")
]

Or in Xcode: File โ†’ Add Package Dependencies and enter the repository URL.

CocoaPods

pod 'Pastel', '~> 1.0.0'

Usage

SwiftUI

Animated gradient background (preset)

import SwiftUI
import Pastel

struct ContentView: View {
    var body: some View {
        Text("Hello")
            .pastelBackground(.instagram)
    }
}

Animated gradient background (custom colors)

Text("Hello")
    .pastelBackground(colors: [
        UIColor(red: 156/255, green: 39/255, blue: 176/255, alpha: 1),
        UIColor(red: 255/255, green: 64/255, blue: 129/255, alpha: 1),
        UIColor(red: 32/255, green: 76/255, blue: 255/255, alpha: 1)
    ], duration: 3.0)

Animated gradient view

PastelGradientView(gradient: .sunset, duration: 4.0)
    .ignoresSafeArea()

Animated gradient text

PastelText("Pastel", font: .largeTitle, gradient: .instagram)

Shared state (coordinate multiple views)

let state = PastelAnimationState(
    colors: [.purple, .pink, .blue],
    duration: 3.0,
    timingCurve: .easeInOut,
    repeatBehavior: .count(5),
    autoreverses: true
)

PastelGradientView(state: state)
PastelText("Hello", state: state)

UIKit

Basic usage

override func viewDidLoad() {
    super.viewDidLoad()

    let pastelView = PastelView(frame: view.bounds)

    // Direction
    pastelView.startPastelPoint = .bottomLeft
    pastelView.endPastelPoint = .topRight

    // Duration
    pastelView.animationDuration = 3.0

    // Colors
    pastelView.setColors([
        UIColor(red: 156/255, green: 39/255, blue: 176/255, alpha: 1),
        UIColor(red: 255/255, green: 64/255, blue: 129/255, alpha: 1),
        UIColor(red: 123/255, green: 31/255, blue: 162/255, alpha: 1),
        UIColor(red: 32/255, green: 76/255, blue: 255/255, alpha: 1),
        UIColor(red: 58/255, green: 255/255, blue: 217/255, alpha: 1)
    ])

    pastelView.startAnimation()
    view.insertSubview(pastelView, at: 0)
}

Shared state with UIKit

let state = PastelAnimationState(
    colors: [.purple, .pink, .blue],
    duration: 3.0,
    timingCurve: .easeInOut
)

let pastelView = PastelView(frame: view.bounds)
pastelView.animationState = state
pastelView.startAnimation()
view.insertSubview(pastelView, at: 0)

๐ŸŽจ Gradient Presets

30 built-in presets available via PastelGradient.

Designed by Alexander Zaytsev โ€” https://dribbble.com/anwaltzzz

Gradient.png

Example Project

Clone the repo and open Example/Pastel.xcodeproj. No additional setup needed โ€” Pastel is linked via SPM automatically.

Author

cruz, [email protected]

Thanks

Many thanks to the contributors of this project.

License

Pastel is available under the MIT license. See the LICENSE file for more info.

๊ด€๋ จ ํ”„๋กœ์ ํŠธ ์‚ดํŽด๋ณด๊ธฐ

๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘โ€ฆ