Hi I'm having trouble in converting the piece of code that it can be used inside a html canvas. I would be appreciate it if someone could help direct me in the right direction.
I never did this, but you could switch to javascript mode (install it, restart processing (all instances), select it as mode) and then export (menu file).
you need to rewrite your sketch for javascript mode - see examples
"you need to rewrite your sketch for javascript mode"
Not necessarily, that's the interest of the so-called JS mode, it is compatible with pure Processing code (most of it), as long as you don't have import statements.
ArrayList should be OK, like other structures listed in the Reference page, as long as they are not too recent (IntList for example is probably not supported). As GoToLoop often say, JS version of Processing supports only an old version of Processing.
There are also some pitfalls, like JS doesn't has true integer support, etc.
Answers
I never did this, but you could switch to javascript mode (install it, restart processing (all instances), select it as mode) and then export (menu file).
you need to rewrite your sketch for javascript mode - see examples
ah, it works
;-)
"you need to rewrite your sketch for javascript mode"
Not necessarily, that's the interest of the so-called JS mode, it is compatible with pure Processing code (most of it), as long as you don't have
import
statements.I see, thank you.
Mine didn't work... because of my usage of ArrayList maybe? Because there wasn't imports or anything other fancy in it...
;-)
ArrayList should be OK, like other structures listed in the Reference page, as long as they are not too recent (IntList for example is probably not supported). As GoToLoop often say, JS version of Processing supports only an old version of Processing.
There are also some pitfalls, like JS doesn't has true integer support, etc.
thank you...
Sorry thank you for your time I haven't had time to get around it, final year in university but I will have a go soon
when you try, processing produces a html page with canvas for you
look in it then
It was a lot simpler than I thought you can directly export to web. Thanks all for your time :)
how did you achieve it?
how does it work?
Once the code is converted into JavaScript mode you can export it straight into a html code