Created
August 5, 2020 12:45
-
-
Save amosgyamfi/127cf3f61f5b410df90dfa8f607f0b76 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
// | |
// ContentView.swift | |
// interaction_mapping | |
// | |
// Created by Amos Gyamfi on 4.8.2020. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State private var blurIntensity: CGFloat = 0 | |
@State private var hueAdjust: Double = 0 | |
@State private var contrastAdjust: Double = 1 | |
@State private var opacityAdjust: Double = 1 | |
@State private var brightnessAdjust: Double = 0 | |
@State private var saturationAdjust: Double = 1 | |
var body: some View { | |
VStack { | |
Text("Fottto") | |
.font(.largeTitle) | |
Spacer() | |
Spacer() | |
Spacer() | |
Image("bigsur") | |
.resizable() | |
.aspectRatio(contentMode: .fit) | |
.opacity(opacityAdjust) | |
.hueRotation(Angle(degrees: hueAdjust)) | |
.brightness(brightnessAdjust) | |
.contrast(contrastAdjust) | |
//.colorInvert() | |
.saturation(saturationAdjust) | |
.blur(radius: blurIntensity) | |
Spacer() | |
VStack { | |
// Adjust blur intensity | |
HStack(spacing: 20) { | |
Text("Blur:") | |
.foregroundColor(Color(.systemBlue)) | |
Slider(value: $blurIntensity, in: 0...10) | |
}.padding(.horizontal, 50) | |
// Adjust brightness | |
HStack(spacing: 20) { | |
Text("Brightness:") | |
.foregroundColor(Color(.systemBlue)) | |
Slider(value: $brightnessAdjust, in: 0...1) | |
}.padding(.horizontal, 50) | |
// Adjust contrast | |
HStack(spacing: 20) { | |
Text("Contrast:") | |
.foregroundColor(Color(.systemBlue)) | |
Slider(value: $contrastAdjust, in: 0...1) | |
}.padding(.horizontal, 50) | |
// Adjust saturation | |
HStack(spacing: 20) { | |
Text("Saturation:") | |
.foregroundColor(Color(.systemBlue)) | |
Slider(value: $saturationAdjust, in: 0...1) | |
}.padding(.horizontal, 50) | |
// Adjust huerotation | |
HStack(spacing: 20) { | |
Text("Rotate Chroma:") | |
.foregroundColor(Color(.systemBlue)) | |
Slider(value: $hueAdjust, in: 0...90) | |
}.padding(.horizontal, 50) | |
// Adjust opacity | |
HStack(spacing: 20) { | |
Text("Transparency:") | |
.foregroundColor(Color(.systemBlue)) | |
Slider(value: $opacityAdjust, in: 0...1) | |
}.padding(.horizontal, 50) | |
} | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
.preferredColorScheme(/*@START_MENU_TOKEN@*/.dark/*@END_MENU_TOKEN@*/) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment