import SwiftUI struct FilmStripView: View { @State private var animate = false // 使用SF Symbols名称数组 private let symbolNames = [ "photo.fill", "heart.fill", "star.fill", "bookmark.fill", "flag.fill", "bell.fill", "tag.fill", "paperplane.fill" ] private let targetIndices = [2, 5, 3] // 每条胶片最终停止的位置 var body: some View { ZStack { Color.black.edgesIgnoringSafeArea(.all) // 三条胶片带 FilmStrip( symbols: symbolNames, targetIndex: targetIndices[0], offset: 0, stripColor: .red ) .rotationEffect(.degrees(5)) .zIndex(1) FilmStrip( symbols: symbolNames, targetIndex: targetIndices[1], offset: 0.3, stripColor: .blue ) .rotationEffect(.degrees(-3)) .zIndex(2) FilmStrip( symbols: symbolNames, targetIndex: targetIndices[2], offset: 0.6, stripColor: .green ) .rotationEffect(.degrees(2)) .zIndex(3) } .onAppear { withAnimation( .timingCurve(0.2, 0.1, 0.8, 0.9, duration: 4.0) ) { animate = true } } } } // 单个胶片带视图 struct FilmStrip: View { let symbols: [String] let targetIndex: Int let offset: Double let stripColor: Color @State private var animate = false var body: some View { GeometryReader { geometry in let itemWidth: CGFloat = 100 let spacing: CGFloat = 8 let totalWidth = itemWidth * CGFloat(symbols.count) + spacing * CGFloat(symbols.count - 1) // 胶片背景 RoundedRectangle(cornerRadius: 10) .fill(stripColor.opacity(0.8)) .frame(height: 160) .overlay( // 胶片齿孔 HStack(spacing: spacing) { ForEach(0..