diff --git a/Example/SharedExample/ContentView.swift b/Example/SharedExample/ContentView.swift index e1923f85d..3695c64f4 100644 --- a/Example/SharedExample/ContentView.swift +++ b/Example/SharedExample/ContentView.swift @@ -10,10 +10,9 @@ import OpenSwiftUI #else import SwiftUI #endif -import Foundation struct ContentView: View { var body: some View { - InsetViewModifierExample() + FlowerView() } } diff --git a/Example/SharedExample/Shape/FlowerView.swift b/Example/SharedExample/Shape/FlowerView.swift new file mode 100644 index 000000000..6af5a9c28 --- /dev/null +++ b/Example/SharedExample/Shape/FlowerView.swift @@ -0,0 +1,46 @@ +// +// FlowerView.swift +// SharedExample + +#if OPENSWIFTUI +import OpenSwiftUI +#else +import SwiftUI +#endif +import Foundation + +struct FlowerView: View { + var body: some View { + ZStack { + ForEach(0..<6) { i in + Capsule() + .fill(i.isMultiple(of: 2) ? .primary : .secondary) + .frame(width: 120, height: 40) + .rotationEffect(.degrees(Double(i) * 30)) + .shadow(color: .purple, radius: 8, x: 4, y: 4) + } + } + .foregroundStyle(.cyan, .orange) + } +} + +struct FlowerViewAnimation: View { + @State private var animate = false + + var body: some View { + ZStack { + ForEach(0..<6) { i in + Capsule() + .fill(i.isMultiple(of: 2) ? .primary : .secondary) + .frame(width: 120, height: 40) + .rotationEffect(.degrees(Double(i) * 30)) + .shadow(color: .purple, radius: 8, x: 4, y: 4) + } + } + .foregroundStyle(.cyan, .orange) + .scaleEffect(animate ? 1.2 : 0.8) + .rotationEffect(.degrees(animate ? 360 : 0)) + .animation(.easeInOut(duration: 2).repeatForever(autoreverses: true), value: animate) + .task { animate = true } + } +}