//
//  Badge.swift
//  Landmarks
//
//  Created by Zihou Wong on 7/2/20.
//  Copyright © 2020 Apple. All rights reserved.
//

import SwiftUI

struct Badge: View {
    static var rotationCount = 8
    
   var badgeSymbols: some View {
        ForEach(0..<Badge.rotationCount) { i in
            RotatedBadgeSymbol(
                angle: .degrees(Double(i) / Double(Badge.rotationCount)) * 360.0
            )
        }
        .opacity(0.5)
    }
    
    
//    rotationEffect(.init(degrees: i * 45), anchor: .top)
    
    var body: some View {
        ZStack {
            BadgeBackground()
            
            
            GeometryReader { geometry in
                self.badgeSymbols
                    .scaleEffect(1.0 / 4.0, anchor: .top)
                    .position(x: geometry.size.width / 2.0 , y: (3.0 / 4.0) * geometry.size.height)
            }
        }.scaledToFit()
    }
}


struct Badge_Previews: PreviewProvider {
    static var previews: some View {
        Badge()
    }
}
