import SwiftUI

struct ThreeColorView: View {
    static let red_x: CGFloat = UIScreen.main.bounds.width/2
    static let red_y: CGFloat = UIScreen.main.bounds.height/3
    
    @State private var redPosition: CGPoint = .init(x: red_x, y: red_y)
    
    @State private var greenPosition: CGPoint = .init(x: red_x - 30, y: red_y + 60)
    
    @State private var bluePosition: CGPoint = .init(x: red_x + 30, y: red_y + 60)
    
    var body: some View {
        ZStack {
            Color.black.ignoresSafeArea()
            
            Circle()
                .fill(Color(.systemRed))
                .frame(width: 200, height: 200)
                .position(redPosition)
                .gesture(
                    DragGesture()
                        .onChanged({ value in
                            redPosition = value.location
                        })
                )
            Circle()
                .fill(Color(.systemGreen))
                .frame(width: 200, height: 200)
                .position(greenPosition)
                .gesture(
                    DragGesture()
                        .onChanged({ value in
                            greenPosition = value.location
                        })
                )
                .blendMode(.lighten)
            
            Circle()
                .fill(Color(.systemBlue))
                .frame(width: 200, height: 200)
                .position(bluePosition)
                .gesture(
                    DragGesture()
                        .onChanged({ value in
                            bluePosition = value.location
                        })
                )
                .blendMode(.lighten)
        }
    }
}