开发者

Get Viewport Width With JQuery and Use In Processing JS

开发者 https://www.devze.com 2023-02-03 08:10 出处:网络
I\'m writing a processingjs script that I want to resize depending on the users viewport width. As far as I know there\'s no functionality for this in processing, so I\'ve been looking at JQuery and u

I'm writing a processingjs script that I want to resize depending on the users viewport width. As far as I know there's no functionality for this in processing, so I've been looking at JQuery and using $(window).width();.

Only I don't know how to get that value into the size(width, height) function in processing.

Any ideas?

Thanks

Links if you need them: http://processingjs.org/ http://api.jquery.com/wid开发者_Python百科th/


You can call $(window).width(); in the size function. Mixing js and p5 code is fine in processing.js.

void setup() {
    size( $(window).width(),
        $(window).height() );
    ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号