imp: fake chat bubbles animation

This commit is contained in:
Ryan Zhao 2023-08-24 13:06:08 +10:00
parent 71433155e5
commit b7e78c5806
1 changed files with 13 additions and 2 deletions

View File

@ -205,14 +205,25 @@ struct FakeChat: View {
id: \.self
) { index in
let chatBubble: ChatBubble = chatBubbles[index]
chatBubble
let bubble = chatBubble
.frame(
maxWidth: .infinity,
alignment: chatBubble.outgoing ? .trailing : .leading
)
.opacity(index < numberOfBubblesShown ? 1.0 : 0.0)
if index < numberOfBubblesShown {
bubble
.transition(
AnyTransition
.move(edge: .bottom)
.combined(with:.opacity.animation(.easeIn(duration: 0.68)))
)
}
}
}
.frame(
height: 320,
alignment: .bottom
)
.padding(.horizontal, 36)
}
}