Created
June 25, 2024 20:31
-
-
Save amosgyamfi/58536d7ff848b214fcc5af9fc9a59fba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MeshGradientColorMixView.swift | |
// OpenSwiftUIDesigns | |
// | |
// Created by Amos Gyamfi on 14.6.2024. | |
// | |
import SwiftUI | |
struct MeshGradientColorMixView: View { | |
let burntSienna = #colorLiteral(red: 0.9137254902, green: 0.4549019608, blue: 0.3176470588, alpha: 1) | |
let burntUmber = #colorLiteral(red: 0.5411764706, green: 0.2, blue: 0.1411764706, alpha: 1) | |
let aquaMarine = #colorLiteral(red: 0.4980392157, green: 1, blue: 0.831372549, alpha: 1) | |
var body: some View { | |
ZStack { | |
MeshGradient( | |
width: 3, | |
height: 3, | |
points: [[0.0, 0.0], [0.5, 0.0], [1.0, 0.0], | |
[0.0, 0.5], [0.9, 0.5], [1.0, 0.5], | |
[0.0, 1.0], [0.5, 1.0], [1.0, 1.0] | |
], | |
colors: [ | |
.red.mix(with: Color(aquaMarine), by: 0.5), | |
.purple.mix(with: Color(aquaMarine), by: 0.8), | |
.indigo.mix(with: Color(burntSienna), by: 0.7), | |
.orange.mix(with: Color(aquaMarine), by: 0.4), | |
.white.mix(with: Color(burntUmber), by: 0.2), | |
.blue.mix(with: Color(burntUmber), by: 0.4), | |
.yellow.mix(with: Color(aquaMarine), by: 0.5), | |
.green.mix(with: Color(burntUmber), by: 0.5), | |
.mint.mix(with: Color(burntSienna), by: 0.5) | |
], | |
smoothsColors: true, | |
colorSpace: .device | |
) | |
} | |
.ignoresSafeArea() | |
} | |
} | |
#Preview { | |
MeshGradientColorMixView() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment