Closed RakeshTatekonda609 closed 1 year ago
+1 no animation from it at all
Same here.
Some debug info I can provide:
If we do the following 3 things, We can see a normal LinearGradient animation.
GradientMask
into AnimatedMask
scaleEffect(3)
callmask
to overlay
in AnimatedMask
If not, we can only see 2 strange phase state after some time.
Tested under Xcode 15 beta 2(15A5161b) with iOS 17 beta 2
I believe this a bug introduced upstream. And should be fixed by Apple's SwiftUI team before a RC release. I've filed a feedback - FB12428834 to Apple's Feedback system to do a follow-up on this.
Thanks for the feedback and the hints! @Kyle-Ye I tried the code you provided, thank you! Using the gradient as an overlay changes the appearance and behaviour considerably, though.
I was able to find a workaround solution by animating the gradient's start and end unit points, rather than its stop locations as before.
Please check this out, currently on this branch: https://github.com/markiv/SwiftUI-Shimmer/tree/iOS17-animate-start-end-points
I've tested this on iOS 15, 16 and 17 (Xcode 15 beta 6), plus also macOS, watchOS and visionOS. 😎
I also added the ability to override the default gradient and introduced a customisable "band size" (the size of the animated mask's "band").
Would love to get your feedback.
Thanks again. 🙏🏽
I was able to find a workaround solution by animating the gradient's start and end unit points, rather than its stop locations as before.
Please check this out, currently on this branch:
iOS17-animate-start-end-points
Yeah, it works for me. Thanks for the fixing.
Tested it under Xcode 15 beta 6 with iOS 17.
I believe this a bug introduced upstream. And should be fixed by Apple's SwiftUI team before a RC release. I've filed a feedback - FB12428834 to Apple's Feedback system to do a follow-up on this.
Update on 2024/03/14:
Update on 2024/03/26:
Here is the final reply from Apple (FB is closed):
After reviewing your feedback, we have some additional information for you, or some additional information, or action is necessary for this issue:
The use of .animation(_:)
is deprecated and is also not recommended for this context.
In theory, you could use the new .animation(_:value:)
and apply it to the content inside of Shimmer, however because the animation in question repeats forever, you run the risk of triggering multiple endless, overlapping animations.
We recommend using a withAnimation when phase is being set:
content
.modifier(
AnimatedMask(phase: phase)
)
.onAppear {
withAnimation(animation) {
phase = 0.8
}
}
When using the GestureMask and the rest of the expected traits in the provided sample project, this produces what seems to be the expected result.
Shimmer animation is not working on XCode 15.0 beta with iOS 17.0