Ask coding questions

← Back to all posts
How does this work
DSAEvan

I can't understand a thing in the code except for some colors. Anybody else know what each thing actually does?

Credit: https://codepen.io/toshiya-marukubo/pen/mdRzyQz

AND IS THERE ANYWHERE THAT CAN TEACH YOU TO DO THESE COOL THINGS?

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
DSAEvan
Comments
hotnewtop
SixBeeps

I had a feeling the tangent function would be used for something like this.

Here's the graph of tan(x):

If applied in the right circumstances, it can cause a sort of slow-motion effect. It makes something go really fast, slow down for a bit, then speed back up. That's what's happening here. The size and position for these rectangles is dependent on this function, which causes the zooming effect you see.

You don't really learn how to make these kinds of things, most of it is just tinkering.

DSAEvan

@SixBeeps ok that’s cool

DSAEvan

The effect is amzaign