Do something repeatedly over time

Abstract

How to schedule something to happen repeatedly

If you want a composition to do something every N seconds, there are several nodes that fire events at a steady rate. The Refreshed at Time trigger port the Fire on Display Refresh node fires every time the computer display refreshes, which is usually about 60 times per second. For a faster or slower rate, you can use the Fire Periodically node.

The composition below uses a Fire Periodically node to change the width and number of tiled copies of an image every 3 seconds. This composition actually has two kinds of repetition over time. One is the change in tile width that occurs every 3 seconds because of the Fire Periodically node. The other is that the tile width repeats itself every 12 seconds. It goes from 2, to 1, to 0.5, to 0.25, and then back to 2. This wrapping-around of the tile width is done by the Count within Range node.

Count within Range is one of many ways to cycle through a series of numbers. Another is the Curve node when its Loop port is set to Loop or Mirror. And another is the Wave node. The composition below (File > Open Example > Motion > Wave Circle) uses the Wave node to make a circle move back and forth.

If you want to cycle through a series of things other than numbers, you can use Cycle through List. Here’s an example (File > Open Example > List > Cycle Seasons) that uses Cycle through List nodes to cycle through colors and texts, displaying the next one each time the mouse is pressed.