After Effect - Triangle Wave (JavaScript)

Posted by PJ Palomaki on Stack Overflow See other posts from Stack Overflow or by PJ Palomaki
Published on 2010-04-09T15:03:22Z Indexed on 2010/04/09 15:13 UTC
Read the original article Hit count: 581

Filed under:
|
|

Hi,

I'm trying to control a parameter with AE expressions and I need a triangle wave. I've got this so far:

freq = 20;
amplitude = 8; 

m = amplitude;
i = time*freq;

m - (i % (2*m) - m);

Unfortunately this gives a saw wave (see below) and my math's a bit rusty, any takers?

Thanks!

PJ

http://i25.photobucket.com/albums/c73/pjburnhill/Screenshot2010-04-09at153815.png

© Stack Overflow or respective owner

Related posts about expressions

Related posts about triangle