A workshop crafted for CCFest 2025


Welcome, welcome! In this workshop, we'll graph looping trigonometric easing functions in Desmos and bring them over to p5.js to let them drive the movement of simple shapes. We'll then see how to record these as perfectly looping animations to share over the interwebs!

Understanding Trigonometric Easing

Introduction to Desmos graphing calculator

The Desmos graphing calculator provides an intuitive interface for exploring mathematical equations visually.

A screenshot of Desmos on the web, showing a diagonal line.

Here’s a simple diagonal line (y = x) plotted in desmos.

Multiple equations can be plotted at the same time to see how they compare.

Another screenshot of Desmos, showing two lines.

Here’s a variation with two equations

Exploring sin(), tan() and other trigonometric functions

Before diving into animation, we need to understand that sine and cosine functions create smooth, cyclical motion patterns.

Try plotting y = sin(x) on desmos and see what comes up!

Screenshot 2025-03-05 at 2.49.26 AM.png

Screenshot 2025-03-05 at 2.49.48 AM.png

What about other trig functions?

Screenshot 2025-03-05 at 2.54.56 AM.png

tan() and cot() go from -∞ to +∞

Screenshot 2025-03-05 at 2.55.23 AM.png

All of these are nice and smooth, and they loop forever. The x-axis here has the input to the sin() function which returns values on the y-axis. Imagine the x-axis being time, incremented at a constant rate. As the seconds go by, our curve changes, and the rate of change is different based on its slope. Keep this in mind, we’ll come back to it later.

You can also nest these functions and see what happens

Screenshot 2025-03-05 at 3.05.07 AM.png

Screenshot 2025-03-05 at 3.05.17 AM.png

You start to see some interesting patterns. We’ll use this idea of nesting and combining these trig functions in different ways later to get smooth motion curves.