You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 2, 2025. It is now read-only.
You won't commonly need to initialize animations directly.
72
+
Each of these methods returns an `AnimationRunner<Value>` instance, which can be used to add completion handlers, wire up additional observers for the running animation, etc.
71
73
72
74
### Simulator / Spring
73
75
`Simulator` uses a physics-based simulation to realistically model changes to a value over time.
@@ -86,6 +88,7 @@ simulator.observe { value in
86
88
}
87
89
```
88
90
91
+
#### Spring
89
92
`Spring` is a specialized simulator that uses a spring function. If all you are after is a simple spring to animate a value, this is what you want.
90
93
91
94
Convenience extensions provide full access to the underlying spring simulation (target, tension, damping, velocity, etc) at any time: even while the simulation is in progress.
@@ -108,6 +111,14 @@ spring.reset(to: 0.5)
108
111
109
112
```
110
113
114
+
#### Simulation Functions
115
+
116
+
Simulations are powered by a **Simulation Function**. These functions compute the forces that should effect the value for every frame, and control *convergence* (or: when the simulation should come to rest). The included simulation functions are:
117
+
-`SpringFunction`
118
+
-`DecayFunction`
119
+
-`GravityFunction`
120
+
121
+
111
122
### Animations
112
123
113
124
Values conforming to the `VectorConvertible` protocol can be animated by Advance. Conforming types can be converted to and from a `Vector` implementation.
@@ -134,13 +145,9 @@ Basic animations use a timing function to control the pacing of the value's chan
134
145
135
146
136
147
#### Simulated animations
137
-
`SimulatedAnimation` use a physics-based approach to model changes to a value over time. This allows for realistic animations that model real-world behavior. `SimulatedAnimation` allows you to use the same simulation functions that power `Simulator` with an `Animator`.
138
-
139
-
Simulated animations are powered by a **Simulation Function**. These functions compute the forces that should effect the animated value for every frame, and control *convergence* (or: when the simulation should come to rest). The included simulation functions are:
140
-
-`SpringFunction`
141
-
-`DecayFunction`
142
-
-`GravityFunction`
148
+
`SimulatedAnimation` uses a physics-based approach to model changes to a value over time, enabling realistic animations that model real-world behavior. `SimulatedAnimation` allows you to use simulation functions as animations (most commonly with an `Animator` instance).
143
149
150
+
#### Creating animations
144
151
145
152
Convenience extensions make it easy to generate animations from `VectorConvertible` types.
<p>In contrast to standard <code>UIView</code> animations, Advance animations are applied on every frame (using <code>CADisplayLink</code> on iOS).</p>
<p>You won’t commonly need to initialize animations directly.</p>
276
+
<p>Each of these methods returns an <code><ahref="Classes/AnimationRunner.html">AnimationRunner<Value></a></code> instance, which can be used to add completion handlers, wire up additional observers for the running animation, etc.</p>
<p><code><ahref="Simulation.html#/s:7Advance6Springa">Spring</a></code> is a specialized simulator that uses a spring function. If all you are after is a simple spring to animate a value, this is what you want.</p>
<p>Simulations are powered by a <strong>Simulation Function</strong>. These functions compute the forces that should effect the value for every frame, and control <em>convergence</em> (or: when the simulation should come to rest). The included simulation functions are:</p>
<p>Values conforming to the <code><ahref="Protocols/VectorConvertible.html">VectorConvertible</a></code> protocol can be animated by Advance. Conforming types can be converted to and from a <code><ahref="Protocols/Vector.html">Vector</a></code> implementation.</p>
<p><code><ahref="Structs/SimulatedAnimation.html">SimulatedAnimation</a></code> use a physics-based approach to model changes to a value over time. This allows for realistic animations that model real-world behavior. <code><ahref="Structs/SimulatedAnimation.html">SimulatedAnimation</a></code> allows you to use the same simulation functions that power <code><ahref="Classes/Simulator.html">Simulator</a></code> with an <code><ahref="Classes/Animator.html">Animator</a></code>.</p>
336
-
337
-
<p>Simulated animations are powered by a <strong>Simulation Function</strong>. These functions compute the forces that should effect the animated value for every frame, and control <em>convergence</em> (or: when the simulation should come to rest). The included simulation functions are:</p>
<p><code><ahref="Structs/SimulatedAnimation.html">SimulatedAnimation</a></code> uses a physics-based approach to model changes to a value over time, enabling realistic animations that model real-world behavior. <code><ahref="Structs/SimulatedAnimation.html">SimulatedAnimation</a></code> allows you to use simulation functions as animations (most commonly with an <code><ahref="Classes/Animator.html">Animator</a></code> instance).</p>
<p>Convenience extensions make it easy to generate animations from <code><ahref="Protocols/VectorConvertible.html">VectorConvertible</a></code> types.</p>
0 commit comments