I want use a button to trigger an animation on the rectangle, but I have no idea how to call an animation from an object that's not the one the animation is being called on.
var body: some View {
GeometryReader { fullView in
ScrollView() {
VStack{
Rectangle()
.foregroundColor(.white)
.frame(width: 150, height: 150)
Button(action: {
print("Here")
//Trigger animation here
}){
Text("Button")
}
Spacer()
}
}
}
}
}
This is the general code that I working with.