Converting Processing to Processing.js... please help?

I think this would be correct. Try this.