Open rathodmayur93 opened 8 months ago
Try again with 3.0.0-beta2 ?
Hi @dreampiggy Thank you for getting back to me. Even after upgrading to 3.0.0 beta 3, I'm still encountering the same problem. Would you please confirm if it's working properly on your side?
A workaround is to use the explicit animation in SwiftUI.
The WebImage
itself contains complicated structure because of animated GIF support (which means, it replace itself with new body when timer of next frame triggered). It's not a simple shape view.
Can you have a try with withAnimation
closure ? https://developer.apple.com/tutorials/swiftui/animating-views-and-transitions
WebImage(url: URL(string: "https://picsum.photos/200"))
.scaledToFit()
.offset(x: isAnimating ? 0 : -1000)
.animation(.linear(duration: 2.0), value: isAnimating)
.onAppear {
withAnimation {
isAnimating = true
}
}
For AnimatedImage
, it use UIViewRepresentable, it's magic handled by SwiftUI X UIKit support and use another render technique, so it's work without additional help.
@dreampiggy, I attempted the solution you suggested, but unfortunately, it is still not working for me
Adding the geometryGroup
modifier to the WebImage
could help resolve the issue. This modifier is effective in addressing conflicts within the animation hierarchy.
If you're using iOS 17 or later, you can try the following:
WebImage(url: url)
.scaledToFit()
.geometryGroup()
For versions prior to iOS 17, consider trying transformEffect(.identity):
WebImage(url: URL(string: "https://picsum.photos/200"))
.scaledToFit()
.transformEffect(.identity)
Hello, I want to express my gratitude for developing this library; it has been working exceptionally well for my project. Lately, I've been attempting to apply an offset animation to a WebImage, but unfortunately, the image doesn't animate at all. Interestingly, when I substitute the WebImage with AsyncImage, the animation works perfectly. Does anyone have any insights into why this might be happening?
Code
Output
https://github.com/SDWebImage/SDWebImageSwiftUI/assets/15011486/90917380-32f3-48e2-882c-4caa3cbbb7ae