Animation fixed in flash cards

This commit is contained in:
Avery Pace 2021-11-08 12:33:39 -05:00
parent fba23ca947
commit 0051d4942d

View File

@ -76,6 +76,7 @@ struct FlashCardStack: View {
ForEach(flashCards.indices, id: \.self) { index in ForEach(flashCards.indices, id: \.self) { index in
flashCards[index] flashCards[index]
.offset(x: 0, y: flashCardsVertOffset[index]) .offset(x: 0, y: flashCardsVertOffset[index])
.animation(.default, value: flashCardsVertOffset[index])
.zIndex(-(CGFloat(index * 10))) .zIndex(-(CGFloat(index * 10)))
} }
} }
@ -242,7 +243,7 @@ struct FlashCard: View {
.rotationEffect(.degrees(isFaceDown ? -(dragAmount / 50) : dragAmount / 50)) .rotationEffect(.degrees(isFaceDown ? -(dragAmount / 50) : dragAmount / 50))
.font(.title) .font(.title)
.rotation3DEffect(self.isFaceDown ? Angle(degrees: 180) : Angle(degrees: 0), axis: (x: 0.0, y: 10.0, z: 0.0)) .rotation3DEffect(self.isFaceDown ? Angle(degrees: 180) : Angle(degrees: 0), axis: (x: 0.0, y: 10.0, z: 0.0))
.animation(.default) .animation(.default, value: isFaceDown)
.onTapGesture { .onTapGesture {
if self.isInteractive == true { if self.isInteractive == true {
self.isFaceDown.toggle() self.isFaceDown.toggle()