Post

Replies

Boosts

Views

Activity

SwiftUI Canvas with 3D Transformation
I'm trying to copying the Colorful Confetti effect in iMessage using SwiftUI Canvas and I am wondering how to apply 3D transformation on each particle. I have tried to add a projectionTransform in order to apply a CATransform3D, but it rotates all the canvas, not a particular particle, which is not the effect I want. Currently, I use the very basic ForEach(particles.indices, id: \.self) loop to create each particle and use .rotation3DEffect to apply that transformation, but it may result in a performance issue (so, I tried to use .drawingGroup()). Is there any solutions to apply 3D transformation to a particular particle in a Canvas?? My code (using ForEach loop): GeometryReader { proxy in let size = proxy.size TimelineView(.animation) { timeline in let _: () = { let now = timeline.date.timeIntervalSinceReferenceDate model.update(at: now) }() ZStack { ForEach(model.particles.indices, id: \.self) { index in let particle = model.particles[index] particle.shape .fill(particle.color) .rotation3DEffect(.degrees(particle.degrees), axis: (x: particle.x, y: particle.y, z: particle.z)) .frame(width: particle.frame.width, height: particle.frame.height) .position(particle.frame.origin) .tag(index) } } .frame(width: size.width, height: size.height) .drawingGroup() } .contentShape(Rectangle()) .gesture( DragGesture(minimumDistance: 0) .onEnded { _ in model.loadEffect(in: size) } ) .task { model.loadEffect(in: size) } }
0
0
914
Jan ’23
numericText transition for normal SwiftUI View
Description In Live Activities, we saw many beautiful animations that powered by .numericText() like Text(time, style: .timer), or even Text with .contentTransition(.numericText()) applied. But it seems like in normal SwiftUI View, these beautiful animations are gone. Instead, we saw a blinking result or fade-in-out result. Is that exactly right? ScreenShots In Live Activity: In normal SwiftUI View:
6
1
5.9k
Dec ’23
App Intents not appear in Shortcuts App
App shortcuts can only be added to Shortcut Action List, but not a separate App Shortcuts appears at the bottom of the Shortcuts app. Now it only has the default Voice Memo App. It successfully appeared in beta 2/3, but I'm not sure if it appeared in (beta 3 update). But in beta 4, it disappeared. I have no idea how to make it visible again!!!
3
1
3.3k
Sep ’22
ShareLink from Menu cannot popup
Menu {      ShareLink(...) ShareLink(...)      ShareLink(...) } label: {   Label("Share", systemImage: "square.and.arrow.up") } Here, I have different share options to choose from, and if I tap one of these share link to share sheet doesn't pop up. Is there any workaround to this issue?
3
2
1.8k
Oct ’22