Is there a way to use a native js function in p5?

please format code with </> button * homework policy * asking questions

Hi, i’am wondering if it is possible to use native js functions in p5. I need, for example, to use the element.scrollTop property, but i don’t know if i can use it in p5.
I wan’t to do this: W3Schools Tryit Editor
but i need to have this “y” variable in p5 so i can then use it. I would not mind if i had to do a native js function and then get the variable value on p5, but i don’t know how to do it either.

Can anyone help me?

Not sure about, the native code, but if you have access to a temporary or permanent location, you can use savestring savetable or any other function to save data which can then be read by any other program.

I did it. It is the simplest thing ever, you just have to write the function outside draw :joy:
function myFunction() {
… (write normal js code)
}

1 Like

thanks, i ended up finding the solution

1 Like