Sin()-function and radians()-function implemented in processing.1.4.16.js?

Hello to all,

I read a bit about the potential difficulties to work with processing.js but so far luckily did not encounter any problem. Only just now it occurs that the sin()-function, probabily also the radians()-function are not implemented neither in processing.1.4.16.js, nor in versions 1.6.0 and 1.6.6 (these three are the versions of processing.js that I could find on the net).

My question is: can anyone help with a version of processing.js that supports those functions or does anyone know about a work-around?

I would be grateful for any help!

All the best,
Andreas

GoToLoop.GitHub.io/processing-js.github.io/reference/sin_/
GoToLoop.GitHub.io/processing-js.github.io/reference/radians_/
GoToLoop.GitHub.io/processing-js.github.io/tools/processing-helper.html

GoToLoop, thank you for the three links! So sin() and radians() a r e implemented!! Yet, it is the following line of code that works fine within the processing player but does not work work when playing the pde with processing.js in a browser:

  float sin = sin(radians(90-(180/enti)*counter))

Whereby enti is a float with value 1800, and counter, also a float, can take values in a range from 0 to 599 (so that the whole expression within radians can take values in a range from 0 to 30.1).
When skipping the line resp. when simply initialising sin with an int, the pde runs fine in the browser…

Can’t see where the problem is. Any help is much appreciated!

You’re replacing/re-assigning sin() function w/ another value there!
Use some other variable name instead of sin!

float sinValue= sin(radians(…

It works fine now!!

So here’s a difference in acceptance: processing itself knows to differenciate between sin and sin(). Happy to have a solution now, thank you very much GoToLoop and Chrisir!!

1 Like