Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Example/SharedExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import OpenSwiftUI
#else
import SwiftUI
#endif
import Foundation

struct ContentView: View {
var body: some View {
InsetViewModifierExample()
FlowerView()
}
}
46 changes: 46 additions & 0 deletions Example/SharedExample/Shape/FlowerView.swift
Original file line number Diff line number Diff line change
@@ -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 }
}
}
Loading