We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I installed p5.js on processing- 3 ide and whenever I bring any change in the index.html file, an error appears which says "the index.html file is damaged and it needs to be removed or renamed." Then I create new HTML file and then also I am not able to bring any change. Can somebody help?
Answers
What changes are you trying to implement? Please, show your code. Also, please provide Processing version and p5.js version as it appears through the Modes manager. Also, make sure you save (hit ctrl+s) when you try to run your sketch.
Kf
//canvasP() and createElement() is not executing. In place of that, i have been using document.write(), then my entire javascript code is not getting executed and the only document.write() statement is getting executed.
//this is sketch.js function setup() { createCanvas(200,200); canvasP('index.html'); // resizeCanvas(windowWidth, windowHeight); //noCanvas(): } function mousePressed(){ createElement('h','press mouse and see the change'); //createP() and createElement() is not working. }
function draw() { background(255); ellipse(200,200,50,50); }
//THIS IS HTML CODE. <!Doctype html>
hello
click me body {padding: 0; margin: 0;}
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
In p5.js mode, at "index.html" tab, we shouldn't edit the lines between
<!-- OK, YOU CAN MAKE CHANGES BELOW THIS LINE AGAIN -->
&<!-- OK, YOU CAN MAKE CHANGES BELOW THIS LINE AGAIN -->
. [-XIn your sketch, you're trying to use createElement() which demands importing library "p5.dom":
In order to include library "p5.dom.js" into "index.html" tab, you need to go to: :-B
Sketch -> Import Library... -> p5.dom
Notice though there's no function called canvasP(). I guess you've meant createP(): L-)
https://p5js.org/reference/#/p5/createP
Notice as well that
<h>
isn't a valid HTML tag.So your
createElement('h', 'press mouse and see the change');
won't get big title letters: #-ohttps://developer.Mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
Some old threads dealing w/ createElement() & createP(): O:-)