Get viewport width using jQuery and use in JS processing

I am writing a processjs script that I want to change depending on the width of the users viewport. As far as I know, there are no functions in the processing for this, so I looked at jQuery and used $(window).width(); .

Only I do not know how to get this value as a function of size (width, height) during processing.

Any ideas?

thanks

Links if you need them: http://processingjs.org/ http://api.jquery.com/width/

+2
source share
1 answer

You can call $ (window) .width (); in size function. Mixing js and p5 code is perfectly handled. Js.

 void setup() { size( $(window).width(), $(window).height() ); ... } 
+5
source share

All Articles