I created a musicplayer UI and want to make it responsive. When the song title is too long I want it to be an marquee text scrolling from the leading of the VStack to trailing side. Once the text reached the trailing side it should cut and appear from the leading side again. Currently it just goes outside of the VStack and then starts the animation over again.

This is my code:
@State var scrollText = false
VStack(alignment: .leading) {
VStack {
Text(album.songs.title ?? "").font(.system(size: 13))
.foregroundColor(Color.white).fixedSize()
.offset(x: scrollText ? 40 : 0)
.animation(Animation.linear(duration: 4)
.repeatForever(autoreverses: false))
.onAppear() {
scrollText.toggle()
}
}.frame(width: 100, height: 18, alignment: .leading)
.background(.red)
Text(album.name).font(.system(size: 9)).foregroundColor(Color.gray)
}
