Skip to content

Commit bb0afb2

Browse files
committed
fix show example
1 parent 4069b6a commit bb0afb2

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ BlenderServoAnimation::Servo(...);
2929

3030
// Blender animation object
3131
BlenderServoAnimation::Animation(...);
32+
33+
// Blender show object
34+
BlenderServoAnimation::Show();
3235
```
3336
3437
When not using the standard servo library, you can use the namespace and therefore skip the namespace prefix:
@@ -41,6 +44,9 @@ Servo(...);
4144
4245
// Blender animation object
4346
Animation(...);
47+
48+
// Blender show object
49+
Show();
4450
```
4551

4652
## Defining Servos
@@ -221,3 +227,41 @@ void setup() {
221227
```
222228
223229
The [SwitchModeButton example](examples/SwitchModeButton) shows how to combine all mode methods to control an animation based on a single button. Make sure to also check out the other [examples](examples) to get started quickly.
230+
231+
## Defining a Show
232+
233+
A show object allows you to combine multiple animations and control their play back in an easy way. You can also think of a show as a playlist of animations. Since the show object does not expect any arguments, the initialization is very simple:
234+
235+
```ino
236+
Show myBlenderShow;
237+
```
238+
239+
### Registering Animations
240+
241+
After defining some animations as shown above, we have to register them to the show object by calling the `addAnimation` method:
242+
243+
```ino
244+
myBlenderShow.addAnimation(myBlenderAnimation);
245+
```
246+
247+
This is usually done inside the `setup` function after the animation and servo objects have been defined globally (outside of any function like `setup` or `loop`).
248+
249+
Alternatively, we can also create an array of animations and call the `addAnimations` method instead:
250+
251+
```ino
252+
Animations myBlenderAnimations[] = {
253+
Animation()
254+
}
255+
Servo myBlenderServos[] = {
256+
Servo(0, BoneA, move),
257+
Servo(1, BoneB, move),
258+
Servo(2, BoneC, move),
259+
...
260+
}
261+
262+
Animation myBlenderAnimation(30, 1000);
263+
264+
void setup() {
265+
myBlenderAnimation.addServos(myBlenderServos);
266+
}
267+
```

examples/Show/Show.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ void move(byte servoID, int angle) {
2424
BlenderServoAnimation::Show show;
2525

2626
// Animation objects to represent the original Blender animations
27-
BlenderServoAnimation::Animation animationA(0, SceneA::FPS, SceneA::FRAMES);
28-
BlenderServoAnimation::Animation animationB(1, SceneB::FPS, SceneB::FRAMES);
27+
BlenderServoAnimation::Animation animationA(SceneA::FPS, SceneA::FRAMES);
28+
BlenderServoAnimation::Animation animationB(SceneB::FPS, SceneB::FRAMES);
2929

3030
// Servo objects to manage the positions
3131
BlenderServoAnimation::Servo myBlenderServoA(0, SceneA::Bone, move);

0 commit comments

Comments
 (0)