Browse Source

commit tag 0.1.2 and add readme

Autumn 5 years ago
parent
commit
2d1f0ee09c
32 changed files with 740 additions and 147 deletions
  1. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Brook.imageset/Brook.jpg
  2. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Brook.imageset/Contents.json
  3. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Chopper.imageset/Chopper.jpg
  4. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Chopper.imageset/Contents.json
  5. 0 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Contents.json
  6. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Franky.imageset/Contents.json
  7. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Franky.imageset/Franky.jpg
  8. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Luffy.imageset/Contents.json
  9. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Luffy.imageset/Luffy.jpg
  10. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Nami.imageset/Contents.json
  11. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Nami.imageset/Nami.jpg
  12. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Robin.imageset/Contents.json
  13. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Robin.imageset/Robin.jpg
  14. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Sanji.imageset/Contents.json
  15. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Sanji.imageset/Sanji.jpg
  16. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Usopp.imageset/Contents.json
  17. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Usopp.imageset/Usopp.jpg
  18. 21 0
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Zoro.imageset/Contents.json
  19. BIN
      ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Zoro.imageset/Zoro.jpg
  20. 13 13
      ACarouselDemo/ACarouselDemo iOS/ContentView.swift
  21. 1 1
      ACarouselDemo/ACarouselDemo macOS/AppDelegate.swift
  22. 0 11
      ACarouselDemo/ACarouselDemo macOS/Assets.xcassets/AccentColor.colorset/Contents.json
  23. 0 58
      ACarouselDemo/ACarouselDemo macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
  24. 114 0
      ACarouselDemo/ACarouselDemo macOS/ContentView.swift
  25. 32 0
      ACarouselDemo/ACarouselDemo macOS/Test.swift
  26. 58 54
      ACarouselDemo/ACarouselDemo.xcodeproj/project.pbxproj
  27. 78 0
      ACarouselDemo/ACarouselDemo.xcodeproj/xcshareddata/xcschemes/ACarouselDemo iOS.xcscheme
  28. 122 1
      README.md
  29. 129 0
      README.zh-CN.md
  30. BIN
      Resource/MacDemo.gif
  31. BIN
      Resource/iPhoneDemo.gif
  32. 4 9
      Sources/ACarousel/ACarousel.swift

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Brook.imageset/Brook.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Brook.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Brook.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Chopper.imageset/Chopper.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Chopper.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Chopper.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 0 - 0
ACarouselDemo/ACarouselDemo macOS/Assets.xcassets/Contents.json → ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Contents.json


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Franky.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Franky.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Franky.imageset/Franky.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Luffy.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Luffy.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Luffy.imageset/Luffy.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Nami.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Nami.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Nami.imageset/Nami.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Robin.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Robin.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Robin.imageset/Robin.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Sanji.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Sanji.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Sanji.imageset/Sanji.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Usopp.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Usopp.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Usopp.imageset/Usopp.jpg


+ 21 - 0
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Zoro.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "Zoro.jpg",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ACarouselDemo/ACarouselDemo iOS/Assets.xcassets/role/Zoro.imageset/Zoro.jpg


+ 13 - 13
ACarouselDemo/ACarouselDemo iOS/ContentView.swift

@@ -7,19 +7,17 @@
 
 import SwiftUI
 import ACarousel
-
-struct Item: Identifiable, Equatable {
+               
+struct Item: Identifiable {
     let id = UUID()
-    let color: Color
+    let image: Image
 }
 
+let roles = ["Luffy", "Zoro", "Sanji", "Nami", "Usopp", "Chopper", "Robin", "Franky", "Brook"]
+
 struct ContentView: View {
     
-    let items: [Item] = [Item(color: .red),
-                          Item(color: .blue),
-                          Item(color: .green),
-                          Item(color: .orange),
-                          Item(color: .purple)]
+    let items: [Item] = roles.map { Item(image: Image($0)) }
     
     @State var spacing: CGFloat = 10
     @State var headspace: CGFloat = 10
@@ -36,12 +34,14 @@ struct ContentView: View {
                       headspace: headspace,
                       sidesScaling: sidesScaling,
                       isWrap: isWrap,
-                      autoScroll: autoScroll ? .active(time) : .inactive) {  item in
-                item.color
-                    .cornerRadius(10)
-                    .overlay(Text("\(items.firstIndex(of: item)!)"))
+                      autoScroll: autoScroll ? .active(time) : .inactive) { item in
+                item.image
+                    .resizable()
+                    .scaledToFill()
+                    .frame(height: 300)
+                    .cornerRadius(30)
             }
-            .frame(height: 200)
+            .frame(height: 300)
             Spacer()
             
             ControlPanel(spacing: $spacing,

+ 1 - 1
ACarouselDemo/ACarouselDemo macOS/AppDelegate.swift

@@ -2,7 +2,7 @@
 //  AppDelegate.swift
 //  ACarouselDemo macOS
 //
-//  Created by Autumn on 2020/11/16.
+//  Created by 帝云科技 on 2020/11/17.
 //
 
 import Cocoa

+ 0 - 11
ACarouselDemo/ACarouselDemo macOS/Assets.xcassets/AccentColor.colorset/Contents.json

@@ -1,11 +0,0 @@
-{
-  "colors" : [
-    {
-      "idiom" : "universal"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 0 - 58
ACarouselDemo/ACarouselDemo macOS/Assets.xcassets/AppIcon.appiconset/Contents.json

@@ -1,58 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "16x16"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "16x16"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "32x32"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "32x32"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "128x128"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "128x128"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "256x256"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "256x256"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "512x512"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "512x512"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 114 - 0
ACarouselDemo/ACarouselDemo macOS/ContentView.swift

@@ -0,0 +1,114 @@
+//
+//  ContentView.swift
+//  ACarouselDemo macOS
+//
+//  Created by Autumn on 2020/11/16.
+//
+
+import SwiftUI
+import ACarousel
+               
+struct Item: Identifiable {
+    let id = UUID()
+    let image: Image
+}
+
+let roles = ["Luffy", "Zoro", "Sanji", "Nami", "Usopp", "Chopper", "Robin", "Franky", "Brook"]
+
+struct ContentView: View {
+    
+    let items: [Item] = roles.map { Item(image: Image($0)) }
+    
+    @State var spacing: CGFloat = 10
+    @State var headspace: CGFloat = 10
+    @State var sidesScaling: CGFloat = 0.8
+    @State var isWrap: Bool = false
+    @State var autoScroll: Bool = false
+    @State var time: TimeInterval = 1
+    
+    var body: some View {
+        VStack {
+            Spacer().frame(height: 30)
+            ACarousel(items,
+                      spacing: spacing,
+                      headspace: headspace,
+                      sidesScaling: sidesScaling,
+                      isWrap: isWrap,
+                      autoScroll: autoScroll ? .active(time) : .inactive) {  item in
+                item.image
+                    .resizable()
+                    .scaledToFill()
+                    .frame(height: 300)
+                    .cornerRadius(30)
+            }
+            .frame(height: 300)
+            Spacer()
+
+            ControlPanel(spacing: $spacing,
+                         headspace: $headspace,
+                         sidesScaling: $sidesScaling,
+                         isWrap: $isWrap,
+                         autoScroll: $autoScroll,
+                         duration: $time)
+            Spacer()
+        }
+    }
+}
+
+struct ControlPanel: View {
+    
+    @Binding var spacing: CGFloat
+    @Binding var headspace: CGFloat
+    @Binding var sidesScaling: CGFloat
+    @Binding var isWrap: Bool
+    @Binding var autoScroll: Bool
+    @Binding var duration: TimeInterval
+    
+    var body: some View {
+        VStack {
+            Group {
+                HStack {
+                    Text("spacing: ").frame(width: 120)
+                    Slider(value: $spacing, in: 0...30, minimumValueLabel: Text("0"), maximumValueLabel: Text("30")) { EmptyView() }
+                }
+                HStack {
+                    Text("headspace: ").frame(width: 120)
+                    Slider(value: $headspace, in: 0...30, minimumValueLabel: Text("0"), maximumValueLabel: Text("30")) { EmptyView() }
+                }
+                HStack {
+                    Text("sidesScaling: ").frame(width: 120)
+                    Slider(value: $sidesScaling, in: 0...1, minimumValueLabel: Text("0"), maximumValueLabel: Text("1")) { EmptyView() }
+                }
+                HStack {
+                    Toggle(isOn: $isWrap, label: {
+                        Text("wrap: ").frame(width: 120)
+                    })
+                }
+                VStack {
+                    HStack {
+                        Toggle(isOn: $autoScroll, label: {
+                            Text("autoScroll: ").frame(width: 120)
+                        })
+                    }
+                    if autoScroll {
+                        HStack {
+                            Text("duration: ").frame(width: 120)
+                            Slider(value: $duration, in: 1...10, minimumValueLabel: Text("1"), maximumValueLabel: Text("10")) { EmptyView() }
+                        }
+                    }
+                }
+            }
+        }
+        .padding([.horizontal, .bottom])
+    }
+}
+
+struct ContentView_Previews: PreviewProvider {
+    static var previews: some View {
+        ContentView()
+    }
+}
+
+
+
+

+ 32 - 0
ACarouselDemo/ACarouselDemo macOS/Test.swift

@@ -0,0 +1,32 @@
+//
+//  Test.swift
+//  ACarouselDemo macOS
+//
+//  Created by 帝云科技 on 2020/11/17.
+//
+
+import SwiftUI
+import ACarousel
+
+struct Test: View {
+    var body: some View {
+        VStack {
+            Image("Zoro")
+                .resizable()
+                .scaledToFill()
+                .frame(height: 100)
+                .clipped()
+            
+            ACarousel(Array(repeating: Item(image: Image("Zoro")), count: 3)) { _ in
+                Color.red
+            }
+            .frame(width: 300, height: 300, alignment: .center)
+        }
+    }
+}
+
+struct Test_Previews: PreviewProvider {
+    static var previews: some View {
+        Test()
+    }
+}

+ 58 - 54
ACarouselDemo/ACarouselDemo.xcodeproj/project.pbxproj

@@ -7,22 +7,24 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		EDC9AF3A2563982100321BC0 /* Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDC9AF392563982100321BC0 /* Test.swift */; };
+		EDC9AF3F2563A19300321BC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDF64C97256241320050A86D /* Assets.xcassets */; };
 		EDF64C92256241310050A86D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64C91256241310050A86D /* AppDelegate.swift */; };
 		EDF64C94256241310050A86D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64C93256241310050A86D /* SceneDelegate.swift */; };
 		EDF64C96256241310050A86D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64C95256241310050A86D /* ContentView.swift */; };
 		EDF64C98256241320050A86D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDF64C97256241320050A86D /* Assets.xcassets */; };
 		EDF64C9B256241320050A86D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDF64C9A256241320050A86D /* Preview Assets.xcassets */; };
 		EDF64C9E256241320050A86D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EDF64C9C256241320050A86D /* LaunchScreen.storyboard */; };
-		EDF64CAB256241520050A86D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64CAA256241520050A86D /* AppDelegate.swift */; };
-		EDF64CAF256241520050A86D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDF64CAE256241520050A86D /* Assets.xcassets */; };
-		EDF64CB2256241520050A86D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDF64CB1256241520050A86D /* Preview Assets.xcassets */; };
-		EDF64CB5256241520050A86D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EDF64CB3256241520050A86D /* Main.storyboard */; };
-		EDF64D3A25625B220050A86D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64C95256241310050A86D /* ContentView.swift */; };
 		EDF64D3F25625B300050A86D /* ACarousel in Frameworks */ = {isa = PBXBuildFile; productRef = EDF64D3E25625B300050A86D /* ACarousel */; };
-		EDF64D4125625B370050A86D /* ACarousel in Frameworks */ = {isa = PBXBuildFile; productRef = EDF64D4025625B370050A86D /* ACarousel */; };
+		EDF64D5D256380F10050A86D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64D5C256380F10050A86D /* AppDelegate.swift */; };
+		EDF64D64256380F10050A86D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDF64D63256380F10050A86D /* Preview Assets.xcassets */; };
+		EDF64D67256380F10050A86D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EDF64D65256380F10050A86D /* Main.storyboard */; };
+		EDF64D70256381410050A86D /* ACarousel in Frameworks */ = {isa = PBXBuildFile; productRef = EDF64D6F256381410050A86D /* ACarousel */; };
+		EDF64DA425638FC50050A86D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64DA325638FC50050A86D /* ContentView.swift */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		EDC9AF392563982100321BC0 /* Test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Test.swift; sourceTree = "<group>"; };
 		EDF64C8E256241310050A86D /* ACarouselDemo iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ACarouselDemo iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		EDF64C91256241310050A86D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		EDF64C93256241310050A86D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -31,14 +33,14 @@
 		EDF64C9A256241320050A86D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
 		EDF64C9D256241320050A86D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		EDF64C9F256241320050A86D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
-		EDF64CA8256241520050A86D /* ACarouselDemo macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ACarouselDemo macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
-		EDF64CAA256241520050A86D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
-		EDF64CAE256241520050A86D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
-		EDF64CB1256241520050A86D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
-		EDF64CB4256241520050A86D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
-		EDF64CB6256241520050A86D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
-		EDF64CB7256241520050A86D /* ACarouselDemo_macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ACarouselDemo_macOS.entitlements; sourceTree = "<group>"; };
 		EDF64D3525625AE10050A86D /* ACarousel */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ACarousel; path = ..; sourceTree = "<group>"; };
+		EDF64D5A256380F10050A86D /* ACarouselDemo macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ACarouselDemo macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+		EDF64D5C256380F10050A86D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
+		EDF64D63256380F10050A86D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
+		EDF64D66256380F10050A86D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+		EDF64D68256380F10050A86D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		EDF64D69256380F10050A86D /* ACarouselDemo_macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ACarouselDemo_macOS.entitlements; sourceTree = "<group>"; };
+		EDF64DA325638FC50050A86D /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -50,11 +52,11 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
-		EDF64CA5256241520050A86D /* Frameworks */ = {
+		EDF64D57256380F10050A86D /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				EDF64D4125625B370050A86D /* ACarousel in Frameworks */,
+				EDF64D70256381410050A86D /* ACarousel in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -66,7 +68,7 @@
 			children = (
 				EDF64D3525625AE10050A86D /* ACarousel */,
 				EDF64C90256241310050A86D /* ACarouselDemo iOS */,
-				EDF64CA9256241520050A86D /* ACarouselDemo macOS */,
+				EDF64D5B256380F10050A86D /* ACarouselDemo macOS */,
 				EDF64C8F256241310050A86D /* Products */,
 				EDF64D3D25625B300050A86D /* Frameworks */,
 			);
@@ -76,7 +78,7 @@
 			isa = PBXGroup;
 			children = (
 				EDF64C8E256241310050A86D /* ACarouselDemo iOS.app */,
-				EDF64CA8256241520050A86D /* ACarouselDemo macOS.app */,
+				EDF64D5A256380F10050A86D /* ACarouselDemo macOS.app */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -103,32 +105,33 @@
 			path = "Preview Content";
 			sourceTree = "<group>";
 		};
-		EDF64CA9256241520050A86D /* ACarouselDemo macOS */ = {
+		EDF64D3D25625B300050A86D /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
-				EDF64CAA256241520050A86D /* AppDelegate.swift */,
-				EDF64CAE256241520050A86D /* Assets.xcassets */,
-				EDF64CB3256241520050A86D /* Main.storyboard */,
-				EDF64CB6256241520050A86D /* Info.plist */,
-				EDF64CB7256241520050A86D /* ACarouselDemo_macOS.entitlements */,
-				EDF64CB0256241520050A86D /* Preview Content */,
 			);
-			path = "ACarouselDemo macOS";
+			name = Frameworks;
 			sourceTree = "<group>";
 		};
-		EDF64CB0256241520050A86D /* Preview Content */ = {
+		EDF64D5B256380F10050A86D /* ACarouselDemo macOS */ = {
 			isa = PBXGroup;
 			children = (
-				EDF64CB1256241520050A86D /* Preview Assets.xcassets */,
+				EDF64D5C256380F10050A86D /* AppDelegate.swift */,
+				EDF64DA325638FC50050A86D /* ContentView.swift */,
+				EDF64D65256380F10050A86D /* Main.storyboard */,
+				EDF64D68256380F10050A86D /* Info.plist */,
+				EDF64D69256380F10050A86D /* ACarouselDemo_macOS.entitlements */,
+				EDF64D62256380F10050A86D /* Preview Content */,
+				EDC9AF392563982100321BC0 /* Test.swift */,
 			);
-			path = "Preview Content";
+			path = "ACarouselDemo macOS";
 			sourceTree = "<group>";
 		};
-		EDF64D3D25625B300050A86D /* Frameworks */ = {
+		EDF64D62256380F10050A86D /* Preview Content */ = {
 			isa = PBXGroup;
 			children = (
+				EDF64D63256380F10050A86D /* Preview Assets.xcassets */,
 			);
-			name = Frameworks;
+			path = "Preview Content";
 			sourceTree = "<group>";
 		};
 /* End PBXGroup section */
@@ -154,13 +157,13 @@
 			productReference = EDF64C8E256241310050A86D /* ACarouselDemo iOS.app */;
 			productType = "com.apple.product-type.application";
 		};
-		EDF64CA7256241520050A86D /* ACarouselDemo macOS */ = {
+		EDF64D59256380F10050A86D /* ACarouselDemo macOS */ = {
 			isa = PBXNativeTarget;
-			buildConfigurationList = EDF64CB8256241520050A86D /* Build configuration list for PBXNativeTarget "ACarouselDemo macOS" */;
+			buildConfigurationList = EDF64D6A256380F10050A86D /* Build configuration list for PBXNativeTarget "ACarouselDemo macOS" */;
 			buildPhases = (
-				EDF64CA4256241520050A86D /* Sources */,
-				EDF64CA5256241520050A86D /* Frameworks */,
-				EDF64CA6256241520050A86D /* Resources */,
+				EDF64D56256380F10050A86D /* Sources */,
+				EDF64D57256380F10050A86D /* Frameworks */,
+				EDF64D58256380F10050A86D /* Resources */,
 			);
 			buildRules = (
 			);
@@ -168,10 +171,10 @@
 			);
 			name = "ACarouselDemo macOS";
 			packageProductDependencies = (
-				EDF64D4025625B370050A86D /* ACarousel */,
+				EDF64D6F256381410050A86D /* ACarousel */,
 			);
 			productName = "ACarouselDemo macOS";
-			productReference = EDF64CA8256241520050A86D /* ACarouselDemo macOS.app */;
+			productReference = EDF64D5A256380F10050A86D /* ACarouselDemo macOS.app */;
 			productType = "com.apple.product-type.application";
 		};
 /* End PBXNativeTarget section */
@@ -186,7 +189,7 @@
 					EDF64C8D256241310050A86D = {
 						CreatedOnToolsVersion = 12.1;
 					};
-					EDF64CA7256241520050A86D = {
+					EDF64D59256380F10050A86D = {
 						CreatedOnToolsVersion = 12.1;
 					};
 				};
@@ -205,7 +208,7 @@
 			projectRoot = "";
 			targets = (
 				EDF64C8D256241310050A86D /* ACarouselDemo iOS */,
-				EDF64CA7256241520050A86D /* ACarouselDemo macOS */,
+				EDF64D59256380F10050A86D /* ACarouselDemo macOS */,
 			);
 		};
 /* End PBXProject section */
@@ -221,13 +224,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
-		EDF64CA6256241520050A86D /* Resources */ = {
+		EDF64D58256380F10050A86D /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				EDF64CB5256241520050A86D /* Main.storyboard in Resources */,
-				EDF64CB2256241520050A86D /* Preview Assets.xcassets in Resources */,
-				EDF64CAF256241520050A86D /* Assets.xcassets in Resources */,
+				EDF64D67256380F10050A86D /* Main.storyboard in Resources */,
+				EDC9AF3F2563A19300321BC0 /* Assets.xcassets in Resources */,
+				EDF64D64256380F10050A86D /* Preview Assets.xcassets in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -244,12 +247,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
-		EDF64CA4256241520050A86D /* Sources */ = {
+		EDF64D56256380F10050A86D /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				EDF64D3A25625B220050A86D /* ContentView.swift in Sources */,
-				EDF64CAB256241520050A86D /* AppDelegate.swift in Sources */,
+				EDF64D5D256380F10050A86D /* AppDelegate.swift in Sources */,
+				EDF64DA425638FC50050A86D /* ContentView.swift in Sources */,
+				EDC9AF3A2563982100321BC0 /* Test.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -264,10 +268,10 @@
 			name = LaunchScreen.storyboard;
 			sourceTree = "<group>";
 		};
-		EDF64CB3256241520050A86D /* Main.storyboard */ = {
+		EDF64D65256380F10050A86D /* Main.storyboard */ = {
 			isa = PBXVariantGroup;
 			children = (
-				EDF64CB4256241520050A86D /* Base */,
+				EDF64D66256380F10050A86D /* Base */,
 			);
 			name = Main.storyboard;
 			sourceTree = "<group>";
@@ -433,7 +437,7 @@
 			};
 			name = Release;
 		};
-		EDF64CB9256241520050A86D /* Debug */ = {
+		EDF64D6B256380F10050A86D /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
@@ -511,7 +515,7 @@
 			};
 			name = Debug;
 		};
-		EDF64CBA256241520050A86D /* Release */ = {
+		EDF64D6C256380F10050A86D /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
@@ -603,11 +607,11 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
-		EDF64CB8256241520050A86D /* Build configuration list for PBXNativeTarget "ACarouselDemo macOS" */ = {
+		EDF64D6A256380F10050A86D /* Build configuration list for PBXNativeTarget "ACarouselDemo macOS" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
-				EDF64CB9256241520050A86D /* Debug */,
-				EDF64CBA256241520050A86D /* Release */,
+				EDF64D6B256380F10050A86D /* Debug */,
+				EDF64D6C256380F10050A86D /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
@@ -619,7 +623,7 @@
 			isa = XCSwiftPackageProductDependency;
 			productName = ACarousel;
 		};
-		EDF64D4025625B370050A86D /* ACarousel */ = {
+		EDF64D6F256381410050A86D /* ACarousel */ = {
 			isa = XCSwiftPackageProductDependency;
 			productName = ACarousel;
 		};

+ 78 - 0
ACarouselDemo/ACarouselDemo.xcodeproj/xcshareddata/xcschemes/ACarouselDemo iOS.xcscheme

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1210"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "EDF64C8D256241310050A86D"
+               BuildableName = "ACarouselDemo iOS.app"
+               BlueprintName = "ACarouselDemo iOS"
+               ReferencedContainer = "container:ACarouselDemo.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+      </Testables>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "EDF64C8D256241310050A86D"
+            BuildableName = "ACarouselDemo iOS.app"
+            BlueprintName = "ACarouselDemo iOS"
+            ReferencedContainer = "container:ACarouselDemo.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "EDF64C8D256241310050A86D"
+            BuildableName = "ACarouselDemo iOS.app"
+            BlueprintName = "ACarouselDemo iOS"
+            ReferencedContainer = "container:ACarouselDemo.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 122 - 1
README.md

@@ -1,3 +1,124 @@
 # ACarousel
 
-A description of this package.
+A carousel view for SwiftUI
+
+English version | [中文文档](README.zh-CN.md)
+
+<p align="center">
+<img src='https://img.shields.io/badge/Swift-5.1-green?style=flat'>
+<img src='https://img.shields.io/badge/platform-iOS%20%7C%20macOS-lightgray.svg?style=flat'>
+<img src='https://img.shields.io/badge/SMP-Supported-orange?style=flat'>
+<img src='https://img.shields.io/github/license/JWAutumn/ACarousel'>
+</p>
+
+<p align="center">
+<img src='Resource/iPhoneDemo.gif' width='260'>&nbsp&nbsp&nbsp
+<img src='Resource/MacDemo.gif' width='350'>
+</p>
+
+## Table of Contents
+
+  - [Requirements](#requirements)
+  - [Install](#install)
+  - [Usage](#usage)
+  - [Example](#example)
+  - [Maintainers](#maintainers)
+  - [Contributing](#contributing)
+  - [License](#license)
+
+
+## Requirements
+
+- iOS 13.0+ / macOS 10.15+ / tvOS 13.0+
+- Xcode 11.0+
+- Swift 5.1+
+
+
+## Install
+
+### Swift Package Manager
+
+Open `Xcode`, go to `File -> Swift Packages -> Add Package Dependency` and enter `https://github.com/JWAutumn/ACarousel`
+
+You can also add `ACarousel` as a dependency to your `Package.swift`:
+```swift
+dependencies: [
+  .package(url: "https://github.com/JWAutumn/ACarousel", from: "0.1.2")
+]
+```
+
+### Manually
+
+[Download](https://github.com/JWAutumn/ACarousel/archive/main.zip) and open the project, drag the `ACarousel.swift` file into your own project.
+
+## Usage
+
+- Basic use: The parameters of `ACarousel` have default values, so you can simply pass in the data source and eat it ~
+```swift
+struct Item: Identifiable, Equatable {
+    let id = UUID()
+    let image: Image
+}
+
+let roles = ["Luffy", "Zoro", "Sanji", "Nami", "Usopp", "Chopper", "Robin", "Franky", "Brook"]
+
+struct ContentView: View {
+    
+    let items: [Item] = roles.map { Item(image: Image($0)) }
+    
+    var body: some View {
+        ACarousel(items) { item in
+            item.image
+                .resizable()
+                .scaledToFill()
+                .frame(height: 300)
+                .cornerRadius(30)
+        }
+        .frame(height: 300)
+    }
+}
+```
+
+- Customize configuration: You can configure the corresponding parameters to customize the display style according to your needs.
+```swift
+ /// ...
+
+struct ContentView: View {
+    
+    let items: [Item] = roles.map { Item(image: Image($0)) }
+    
+    var body: some View {
+        ACarousel(items,
+                  spacing: 10,
+                  headspace: 10,
+                  sidesScaling: 0.7,
+                  isWrap: true,
+                  autoScroll: .active(2)) { item in
+            item.image
+                .resizable()
+                .scaledToFill()
+                .frame(height: 300)
+                .cornerRadius(30)
+        }
+        .frame(height: 300)
+    }
+}
+```
+
+
+## Example
+[Download](https://github.com/JWAutumn/ACarousel/archive/main.zip) and open `ACarouselDemo -> ACarouselDemo.xcodeproj`, run and view.
+
+## Maintainers
+
+[@JWAutumn](https://github.com/JWAutumn).
+
+
+## Contributing
+
+Feel free to dive in! [Open an issue](https://github.com/JWAutumn/ACarousel/issues/new) or submit PRs.
+
+
+## License
+
+[MIT](LICENSE) © JWAutumn

+ 129 - 0
README.zh-CN.md

@@ -0,0 +1,129 @@
+# ACarousel
+
+`SwiftUI` 旋转木马效果
+
+[English version](README.md) | 中文文档
+
+<p align="center">
+<img src='https://img.shields.io/badge/Swift-5.1-green?style=flat'>
+<img src='https://img.shields.io/badge/platform-iOS%20%7C%20macOS-lightgray.svg?style=flat'>
+<img src='https://img.shields.io/badge/SMP-Supported-orange?style=flat'>
+<img src='https://img.shields.io/github/license/JWAutumn/ACarousel'>
+</p>
+
+<p align="center">
+<img src='Resource/iPhoneDemo.gif' width='260'>&nbsp&nbsp&nbsp
+<img src='Resource/MacDemo.gif' width='350'>
+</p>
+
+## 内容列表
+
+  - [要求](#要求)
+  - [安装](#安装)
+  - [使用说明](#使用说明)
+  - [示例](#示例)
+  - [维护者](#维护者)
+  - [如何贡献](#如何贡献)
+  - [使用许可](#使用许可)
+
+
+## 要求
+
+- iOS 13.0+ / macOS 10.15+ / tvOS 13.0+
+- Xcode 11.0+
+- Swift 5.1+
+
+
+## 安装
+
+### Swift Package Manager
+
+打开 `Xcode`, 选择 `File -> Swift Packages -> Add Package Dependency`,输入 `https://github.com/JWAutumn/ACarousel`
+
+也可以将 `ACarousel` 作为依赖添加项到你的 `Package.swift` 中:
+```swift
+dependencies: [
+  .package(url: "https://github.com/JWAutumn/ACarousel", from: "0.1.2")
+]
+```
+
+### 手动安装
+
+[下载](https://github.com/JWAutumn/ACarousel/archive/main.zip)并打开项目,把 `ACarousel.swift` 文件拖入到你自己的项目当中。
+
+当然,你也可以根据特定需求修改代码。
+
+
+## 使用说明
+
+ - 基础使用:`ACarousel` 的参数有默认值,你只需要简单的传入数据源即可食用~
+```swift
+struct Item: Identifiable, Equatable {
+    let id = UUID()
+    let image: Image
+}
+
+let roles = ["Luffy", "Zoro", "Sanji", "Nami", "Usopp", "Chopper", "Robin", "Franky", "Brook"]
+
+struct ContentView: View {
+    
+    let items: [Item] = roles.map { Item(image: Image($0)) }
+    
+    var body: some View {
+        ACarousel(items) { item in
+            item.image
+                .resizable()
+                .scaledToFill()
+                .frame(height: 300)
+                .cornerRadius(30)
+        }
+        .frame(height: 300)
+    }
+}
+```
+
+- 自定义参数:根据自身需求,你可以修改相应的参数来自定义显示样式。
+```swift
+ /// ...
+
+struct ContentView: View {
+    
+    let items: [Item] = roles.map { Item(image: Image($0)) }
+    
+    var body: some View {
+        ACarousel(items,
+                  spacing: 10,
+                  headspace: 10,
+                  sidesScaling: 0.7,
+                  isWrap: true,
+                  autoScroll: .active(2)) { item in
+            item.image
+                .resizable()
+                .scaledToFill()
+                .frame(height: 300)
+                .cornerRadius(30)
+        }
+        .frame(height: 300)
+    }
+}
+```
+
+
+## 示例
+
+[下载](https://github.com/JWAutumn/ACarousel/archive/main.zip)项目,打开 `ACarouselDemo -> ACarouselDemo.xcodeproj` 运行并查看
+
+
+## 维护者
+
+[@JWAutumn](https://github.com/JWAutumn)。
+
+## 如何贡献
+
+非常欢迎你的加入![提一个 Issue](https://github.com/JWAutumn/ACarousel/issues/new) 或者提交一个 Pull Request。
+
+
+
+## 使用许可
+
+[MIT](LICENSE) © JWAutumn

BIN
Resource/MacDemo.gif


BIN
Resource/iPhoneDemo.gif


+ 4 - 9
Sources/ACarousel/ACarousel.swift

@@ -55,7 +55,8 @@ public struct ACarousel<Data, Content> : View where Data : RandomAccessCollectio
         HStack(spacing: spacing) {
             ForEach(data) {
                 content($0)
-                    .frame(width: itemWidth(proxy), height: itemHeight(proxy, $0))
+                    .frame(width: itemWidth(proxy))
+                    .scaleEffect(x: 1, y: itemScale($0), anchor: .center)
             }
         }
         .offset(x: offsetValue(proxy))
@@ -166,19 +167,13 @@ extension ACarousel {
         itemWidth(proxy) + spacing
     }
     
-    /// height of subview
-    /// - Parameters:
-    ///   - proxy: GeometryProxy
-    ///   - item: child data
-    /// - Returns: height
-    private func itemHeight(_ proxy: GeometryProxy, _ item: Data.Element) -> CGFloat {
+    private func itemScale(_ item: Data.Element) -> CGFloat {
         guard aState.activeItem < data.count else {
             return 0
         }
-        return data[aState.activeItem].id == item.id ? proxy.size.height : proxy.size.height * sidesScaling
+        return AnyHashable(data[aState.activeItem].id) == AnyHashable(item.id) ? 1 : sidesScaling
     }
     
-    
 }