@@ -10,9 +10,41 @@ struct AnimationPlayground: View {
1010 @State private var grown = false
1111 @State private var recolored = false
1212 @State private var crawled = false
13+ @State private var showSlide = false
14+ @State private var showScale = false
1315 var body : some View {
1416 ScrollView {
1517 VStack ( alignment: . leading, spacing: 0 ) {
18+ Example ( " Transition: move + fade " ) {
19+ VStack ( alignment: . leading, spacing: 8 ) {
20+ Button ( showSlide ? " Remove " : " Insert " ) {
21+ withAnimation { showSlide. toggle ( ) }
22+ }
23+ if showSlide {
24+ Text ( " I move in from the leading edge and fade " )
25+ . foregroundColor ( . white)
26+ . padding ( )
27+ . background ( Color . blue)
28+ . cornerRadius ( 8 )
29+ . transition ( . move( edge: . leading) )
30+ }
31+ }
32+ }
33+ Example ( " Transition: scale " ) {
34+ VStack ( alignment: . leading, spacing: 8 ) {
35+ Button ( showScale ? " Remove " : " Insert " ) {
36+ withAnimation ( . spring( ) ) { showScale. toggle ( ) }
37+ }
38+ if showScale {
39+ Text ( " I scale in and out " )
40+ . foregroundColor ( . white)
41+ . padding ( )
42+ . background ( Color . purple)
43+ . cornerRadius ( 8 )
44+ . transition ( . scale)
45+ }
46+ }
47+ }
1648 Example ( " withAnimation: offset " ) {
1749 VStack ( alignment: . leading, spacing: 8 ) {
1850 Circle ( )
0 commit comments