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
In this example, the `FadeTransition` will fade 5% every frame.
112
+
In this example, the `FadeTransition` will fade 5% every frame. There is also the option for a timed transition using `NewTicksTimedFadeTransition`(for a ticks based timming) or `NewDurationTimedFadeTransition`(for a real-time based timming).
102
113
103
114
### Slide Transition
104
115
@@ -108,13 +119,13 @@ The `SlideTransition` will slide out the current scene and slide in the new scen
In this example, the `SlideTransition` will slide in the new scene from the left 5% every frame.
128
+
In this example, the `SlideTransition` will slide in the new scene from the left 5% every frame. There is also the option for a timed transition using `NewTicksTimedSlideTransition`(for a ticks based timming) or `NewDurationTimedSlideTransition`(for a real-time based timming).
118
129
119
130
### Custom Transitions
120
131
@@ -123,30 +134,117 @@ You can also define your own transition, simply implement the `SceneTransition`
When a scene is transitioned, the `Load` and `Unload` methods are called **twice** for the destination and original scenes respectively. Once at the start and again at the end of the transition. This behavior can be changed for additional control by implementing the `TransitionAwareScene` interface.
With this you can insure that those methods are only called once on transitions and can control your scenes at each point of the transition. The execution order will be:
176
+
177
+
```shell
178
+
PreTransition Called on old scene
179
+
Load Called on new scene
180
+
Updated old scene
181
+
Updated new scene
182
+
...
183
+
Updated old scene
184
+
Updated new scene
185
+
Unload Called on old scene
186
+
PostTransition Called on new scene
187
+
```
188
+
189
+
## SceneDirector
190
+
191
+
The `SceneDirector` is an alternative way to manage the transitions between scenes. It provides transitioning between scenes based on a set of rules just like a FSM. The `Scene` implementation is the same, with only a feel differences, first you need to assert the `SceneDirector` instead of the `SceneManager`:
Now you can now notify the `SceneDirector` about activated `SceneTransitionTrigger`, if no `Directive` match, the code will still run without errors.
238
+
239
+
```go
240
+
func(s *MyScene) Update() error {
241
+
// ...
242
+
s.manager.ProcessTrigger(Trigger)
243
+
244
+
// ...
245
+
}
246
+
```
247
+
150
248
## Contribution
151
249
152
250
Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you would like to contribute code, please fork the repository and submit a pull request.
@@ -159,4 +257,4 @@ go test ./...
159
257
160
258
## License
161
259
162
-
Stagehand is released under the [MIT License](https://github.com/example/stagehand/blob/master/LICENSE).
260
+
Stagehand is released under the [MIT License](https://github.com/joelschutz/stagehand/blob/master/LICENSE).
0 commit comments