Tutorial

Overview

What are Behaviors?

Behaviors are functions or classes that package movements and logic into units that can be given to Ayva to perform. They allow for inheritance and composition to create more complex, reusable, and holistic experiences.

There are some built-in behaviors, and you can create custom behaviors that utilize those. Or you can create something entirely new!

do()

The entry point for behaviors is Ayva's simple do() method. It takes a behavior and performs that behavior until commanded to stop (or the behavior completes). The following example uses the built-in behavior ClassicStroke, a class whose default configuration commands Ayva to perform a full stroke at one stroke per second:

ayva.do(new ClassicStroke());

Note: A ClassicStroke does not complete, so this will continue forever until ayva.stop() is called, or ayva.do() is called with another behavior to perform instead.

Try it out!

How to create your own behaviors will be covered in later sections. The next section details how to configure ClassicStroke for more complex (and fun 😉) experiences.