Skip to content

Commit 2f63ff0

Browse files
authored
Try final links
1 parent 11762b2 commit 2f63ff0

1 file changed

Lines changed: 33 additions & 36 deletions

File tree

docs/animation_docs/Animation_Tutorial.md

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ This chapter covers the basics: creating simple animations, using colors, and la
6161

6262
### 1.1 Your First Animation: Solid Color
6363

64-
![Solid Red](../../_media/berry_animation/chap_1_10.png)
65-
66-
<img src="../../_media/berry_animation/chap_1_10.png">
67-
<img src="png/chap_1_10.png">
64+
<img src="../../_media/berry_animation/chap_1_10.png" alt="Solid Red">
6865

6966
Every animation starts with two steps: **define** it, then **run** it. The simplest animation fills the entire strip with a single color.
7067

@@ -85,7 +82,7 @@ The DSL provides many predefined colors: `red`, `green`, `blue`, `white`, `yello
8582

8683
### 1.2 Custom Colors
8784

88-
![Custom Color](/docs/_media/berry_animation/chap_1_20.png)
85+
<img src="../../_media/berry_animation/chap_1_20.png" alt="Custom Color">
8986

9087
Predefined colors are convenient, but you'll often want specific shades. Define custom colors using hexadecimal values.
9188

@@ -113,7 +110,7 @@ The DSL also provides `transparent` as a predefined color, equivalent to `0x0000
113110

114111
### 1.3 Using Predefined Animations
115112

116-
![Twinkle Stars](png/chap_1_30.png)
113+
<img src="../../_media/berry_animation/chap_1_30.png" alt="Twinkle Stars">
117114

118115
Beyond `solid`, the DSL includes many ready-to-use animation types. Each creates a different visual effect. Let's try `twinkle_animation`, which creates a twinkling stars effect.
119116

@@ -128,7 +125,7 @@ With no parameters, animations use sensible defaults. The twinkle effect will us
128125

129126
### 1.4 Animation Parameters
130127

131-
![Twinkle Parameters](png/chap_1_40.png)
128+
<img src="../../_media/berry_animation/chap_1_40.png" alt="Twinkle Parameters">
132129

133130
Most animations accept **parameters** to customize their behavior. Parameters use the `name=value` syntax inside the parentheses.
134131

@@ -156,7 +153,7 @@ run stars
156153

157154
### 1.5 Layering Animations
158155

159-
![Twinkle Night](png/chap_1_50.png)
156+
<img src="../../_media/berry_animation/chap_1_50.png" alt="Twinkle Night">
160157

161158
One of the most powerful features is **layering** - running multiple animations simultaneously. Each animation has a `priority` that determines its rendering order. Think of it like layers in an image editor: lower numbers are "on top" and can obscure higher numbers.
162159

@@ -198,7 +195,7 @@ The key concept is the **color provider** - instead of a fixed color value, you
198195

199196
### 2.1 Built-in Palette Cycling
200197

201-
![Palette Rotation](png/chap_2_10.png)
198+
<img src="../../_media/berry_animation/chap_2_10.png" alt="Palette Rotation">
202199

203200
The simplest way to create changing colors is with `color_cycle`, which steps through a palette of colors over time.
204201

@@ -229,7 +226,7 @@ The `color_cycle` function creates a color provider that cycles through the pale
229226

230227
### 2.2 Custom Palettes
231228

232-
![Custom Palette](png/chap_2_20.png)
229+
<img src="../../_media/berry_animation/chap_2_20.png" alt="Custom Palette">
233230

234231
Built-in palettes are convenient, but you'll often want your own color schemes. Define custom palettes as arrays of hex colors.
235232

@@ -266,7 +263,7 @@ Chapter 2 showed `color_cycle`, which steps discretely between colors. This chap
266263

267264
### 3.1 Rich Palette Animation
268265

269-
![Rich Palette](png/chap_3_10.png)
266+
<img src="../../_media/berry_animation/chap_3_10.png" alt="Rich Palette">
270267

271268
The `rich_palette_animation` is a complete animation that handles both the color transitions and rendering. It's the easiest way to get smooth rainbow effects.
272269

@@ -284,7 +281,7 @@ With no parameters, it uses sensible defaults. The `transition_type=SINE` create
284281

285282
### 3.2 Rich Palette with Custom Colors
286283

287-
![Rich Palette Custom](png/chap_3_20.png)
284+
<img src="../../_media/berry_animation/chap_3_20.png" alt="Rich Palette Custom">
288285

289286
For more control, use `rich_palette` as a **color provider** (not an animation). This lets you use smooth color transitions with any animation type.
290287

@@ -328,7 +325,7 @@ The key insight is that color providers can work in two dimensions:
328325

329326
### 4.1 Rainbow Gradient
330327

331-
![Color Pattern](png/chap_4_10.png)
328+
<img src="../../_media/berry_animation/chap_4_10.png" alt="Color Pattern">
332329

333330
A gradient maps colors to positions along the strip. The `palette_gradient_animation` does exactly this.
334331

@@ -347,7 +344,7 @@ The magic is `period=0` - this tells the color provider to ignore time and only
347344

348345
### 4.2 Multiple Gradient Repetitions
349346

350-
![Gradient 2x](png/chap_4_12.png)
347+
<img src="../../_media/berry_animation/chap_4_12.png" alt="Gradient 2x">
351348

352349
By default, the gradient spans the entire strip once. Use `spatial_period` to control how many LEDs one complete gradient cycle covers.
353350

@@ -374,7 +371,7 @@ With `spatial_period = strip_len / 2`, the gradient repeats twice across the str
374371

375372
### 4.3 Oscillating Spatial Period
376373

377-
![Oscillating Period](png/chap_4_15.png)
374+
<img src="../../_media/berry_animation/chap_4_15.png" alt="Oscillating Period">
378375

379376
Here's where things get interesting: you can make **any parameter dynamic** by using a value provider instead of a fixed number. This example makes the gradient "breathe" by oscillating its spatial period.
380377

@@ -407,7 +404,7 @@ The `sine_osc` function creates a **value provider** - a number that changes smo
407404

408405
### 4.4 Rotating Gradient
409406

410-
![Rotating Gradient](png/chap_4_18.png)
407+
<img src="../../_media/berry_animation/chap_4_18.png" alt="Rotating Gradient">
411408

412409
Make the gradient rotate along the strip:
413410

@@ -427,7 +424,7 @@ The `shift_period` parameter makes the entire pattern shift along the strip.
427424

428425
### 4.5 VU-Meter Style Animation
429426

430-
![VU Meter](png/chap_4_30.png)
427+
<img src="../../_media/berry_animation/chap_4_30.png" alt="VU Meter">
431428

432429
Create a meter/bar that fills based on a value:
433430

@@ -460,7 +457,7 @@ The palette uses position-based entries `(position, color)` where position range
460457

461458
### 4.6 Custom Value Functions
462459

463-
![Random Meter](png/chap_4_35.png)
460+
<img src="../../_media/berry_animation/chap_4_35.png" alt="Random Meter">
464461

465462
Sometimes the built-in oscillators aren't enough - you need custom logic like random values, sensor readings, or complex calculations. The DSL lets you embed native Berry code and use it in your animations.
466463

@@ -526,7 +523,7 @@ A beacon has five key properties:
526523

527524
### 5.1 Static Beacon
528525

529-
![Static Beacon](png/chap_5_10.png)
526+
<img src="../../_media/berry_animation/chap_5_10.png" alt="Static Beacon">
530527

531528
Let's start with a stationary beacon - a red highlight on a blue background.
532529

@@ -544,7 +541,7 @@ run back
544541

545542
### 5.2 Beacon with Slew (Soft Edges)
546543

547-
![Beacon Slew](png/chap_5_15.png)
544+
<img src="../../_media/berry_animation/chap_5_15.png" alt="Beacon Slew">
548545

549546
Hard edges can look harsh. The `slew_size` parameter adds a gradual fade on each side of the beacon, creating softer, more natural-looking highlights.
550547

@@ -572,7 +569,7 @@ run back
572569

573570
### 5.3 Animated Slew
574571

575-
![Oscillating Slew](png/chap_5_20.png)
572+
<img src="../../_media/berry_animation/chap_5_20.png" alt="Oscillating Slew">
576573

577574
Remember: any numeric parameter can be replaced with a value provider. Here we make the slew size pulse in and out.
578575

@@ -593,7 +590,7 @@ run back
593590

594591
### 5.4 Cylon Eye (Moving Beacon)
595592

596-
![Cylon Eye](png/chap_5_30.png)
593+
<img src="../../_media/berry_animation/chap_5_30.png" alt="Cylon Eye">
597594

598595
Now for the classic effect: a beacon that moves back and forth across the strip. We use `cosine_osc` on the `pos` parameter to create smooth scanning motion.
599596

@@ -615,7 +612,7 @@ The cosine oscillator creates smooth acceleration and deceleration at the ends,
615612

616613
### 5.5 Rainbow Cylon with Stars
617614

618-
![Rainbow Cylon](png/chap_5_40.png)
615+
<img src="../../_media/berry_animation/chap_5_40.png" alt="Rainbow Cylon">
619616

620617
Let's combine everything we've learned: layered animations, dynamic colors, and moving beacons. This example creates a scene with two layers.
621618

@@ -664,7 +661,7 @@ The result: a rainbow-colored eye scans across a field of twinkling stars, with
664661

665662
### 5.6 Beacon as Opacity Mask
666663

667-
![Opacity Mask](png/chap_5_50.png)
664+
<img src="../../_media/berry_animation/chap_5_50.png" alt="Opacity Mask">
668665

669666
Instead of layering animations with priority, you can use one animation as an **opacity mask** for another. This creates a "window" effect where the mask controls what's visible.
670667

@@ -725,7 +722,7 @@ Sequences are essential when you need things to happen in order: play animation
725722

726723
### 6.1 Simple Shutter
727724

728-
![Simple Shutter](png/chap_6_10.png)
725+
<img src="../../_media/berry_animation/chap_6_10.png" alt="Simple Shutter">
729726

730727
A shutter effect is simply a beacon with an animated size. Using `sawtooth` makes it grow linearly then reset.
731728

@@ -748,7 +745,7 @@ run shutter_lr_animation
748745

749746
### 6.2 Shutter with Rotating Colors
750747

751-
![Rotating Shutter](png/chap_6_20.png)
748+
<img src="../../_media/berry_animation/chap_6_20.png" alt="Rotating Shutter">
752749

753750
Now let's add color changes after each shutter cycle. This requires a **sequence** - a way to run code at specific times.
754751

@@ -812,7 +809,7 @@ This gives you precise control over color changes, synchronized with your sequen
812809

813810
### 6.3 Central Shutter
814811

815-
![Central Shutter](png/chap_6_30.png)
812+
<img src="../../_media/berry_animation/chap_6_30.png" alt="Central Shutter">
816813

817814
Instead of expanding from the left edge, this shutter expands from the center outward.
818815

@@ -861,7 +858,7 @@ run shutter_seq
861858

862859
### 6.4 Bidirectional Shutter
863860

864-
![Bidirectional Shutter](png/chap_6_40.png)
861+
<img src="../../_media/berry_animation/chap_6_40.png" alt="Bidirectional Shutter">
865862

866863
This example combines both directions: first the shutter expands from center (in-out), then contracts back to center (out-in). The sequence cycles through all palette colors in each direction before switching.
867864

@@ -943,7 +940,7 @@ Crenels create repeating square wave patterns - alternating blocks of two colors
943940

944941
### 7.1 Static Crenel
945942

946-
![Static Crenel](png/chap_7_10.png)
943+
<img src="../../_media/berry_animation/chap_7_10.png" alt="Static Crenel">
947944

948945
A basic crenel alternates between two colors with configurable block sizes.
949946

@@ -976,7 +973,7 @@ This creates a pattern: 🔴🔴🔵🔵🔴🔴🔵🔵... across the entire st
976973

977974
### 7.2 Variable Number of Pulses
978975

979-
![Variable Pulses](png/chap_7_20.png)
976+
<img src="../../_media/berry_animation/chap_7_20.png" alt="Variable Pulses">
980977

981978
Instead of showing all pulses (`nb_pulse = -1`), you can animate the number of visible pulses using a value provider. The `triangle` oscillator smoothly varies `nb_pulse` from 0 (no pulses) to the maximum that fits on the strip.
982979

@@ -1003,7 +1000,7 @@ run back
10031000

10041001
### 7.3 Variable Pulse Size
10051002

1006-
![Variable Size](png/chap_7_30.png)
1003+
<img src="../../_media/berry_animation/chap_7_30.png" alt="Variable Size">
10071004

10081005
Instead of a fixed `pulse_size`, you can use a value provider to animate the pulse width over time. Here, a `triangle` oscillator smoothly varies the pulse size between 0 and 4 pixels over 2 seconds, creating a breathing effect on the crenel pattern:
10091006

@@ -1023,7 +1020,7 @@ run back
10231020

10241021
### 7.4 Dynamic Colors
10251022

1026-
![Dynamic Colors](png/chap_7_40.png)
1023+
<img src="../../_media/berry_animation/chap_7_40.png" alt="Dynamic Colors">
10271024

10281025
The `color` parameter also accepts a color provider instead of a static color. This example uses `rich_palette` to cycle through rainbow colors over 5 seconds, making the crenel pulses continuously change color while the blue background remains fixed:
10291026

@@ -1043,7 +1040,7 @@ run back
10431040

10441041
### 7.5 Crenel as Opacity Mask
10451042

1046-
![Crenel Mask](png/chap_7_50.png)
1043+
<img src="../../_media/berry_animation/chap_7_50.png" alt="Crenel Mask">
10471044

10481045
Instead of using a crenel directly as a visible animation, you can use it as an **opacity mask** for another animation. This creates a "window" effect where the crenel pattern controls what's visible.
10491046

@@ -1097,7 +1094,7 @@ Think of templates like functions in programming: define once, use many times wi
10971094

10981095
### 8.1 Simple Template: Cylon Eye
10991096

1100-
![Template Cylon](png/chap_8_10.png)
1097+
<img src="../../_media/berry_animation/chap_8_10.png" alt="Template Cylon">
11011098

11021099
The `template animation` keyword creates a new animation type that can be instantiated just like built-in animations (`solid`, `beacon_animation`, etc.). Once defined, you use it by calling `animation my_anim = template_name(param1=value1, ...)` - exactly like native animations.
11031100

@@ -1159,7 +1156,7 @@ run eye
11591156

11601157
### 8.2 Template with Palette Parameter
11611158

1162-
![Template Color Cycle](png/chap_8_20.png)
1159+
<img src="../../_media/berry_animation/chap_8_20.png" alt="Template Color Cycle">
11631160

11641161
Templates can accept complex types like palettes. Here we create a reusable color cycling animation where the user provides their own palette and cycle period:
11651162

@@ -1189,7 +1186,7 @@ run main
11891186

11901187
### 8.3 Advanced Template with Conditional Flags
11911188

1192-
![Template Shutter](png/chap_8_30.png)
1189+
<img src="../../_media/berry_animation/chap_8_30.png" alt="Template Shutter">
11931190

11941191
Templates support `bool` parameters that can be used with `if` statements inside sequences. This allows users to enable or disable parts of the animation at instantiation time. Here we create a bidirectional shutter that can optionally run in-out, out-in, or both directions.
11951192

0 commit comments

Comments
 (0)