Editing a custom animation

You’re continuing to edit the Project from the last two pages.

1. Use a custom Python Animation

The bp new command creates a new custom Python animation for you to play with. In this case, it’s called my_lights.MyLights.

Delete the animation: lines above with the sequence, scroll down a little to the lines at the end of the Project file, and uncomment them:

animation:
  typename: my_lights.MyLights
  color: red

Resulting in this:

Result

Run the Project again. Change the color: line to read color: goldenrod and run it again to get this:

Result

2. Editing a Python Animation

Now let’s change the Python code.

With your text editor, edit the Python file my_lights.py.

After these lines in the file:

# Set the previous pixel to black.
self.color_list[this_pixel - 1] = COLORS.black

add these two lines:

self.color_list[this_pixel - 2] = COLORS.yellow
self.color_list[this_pixel - 3] = COLORS.black

and run it again to get this:

Result
shape: [64, 16]
animation: $bpa.matrix.GameOfLife.GameOfLifeRGB
doc/tutorial/getting-started/editing-an-animation-footer