Bienvenu
1. Organisation
Pour réaliser votre première application Web/Javascript vous n’avez réellement besoin que de 2 fichiers, index.html et ‘sketch.js’.
- La structure du répertoire accueillant votre application
-application
-js
sketch.js
class.js
-images
im00x.png
index.html2. Le fichier de référence HTML
Le fichier Index.html
<html>
<header>
</header>
<body>
<div id= "sketch-dev"> </div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/p5@1.4.0/lib/p5.min.js"></script>
<script type="text/javascript" src="/developpement/js/class.js"></script>
<script type="text/javascript" src="/developpement/js/sketch.js"></script>
</body>
</html>Le fichier sketch.js
const eC = {version: 'r01'};
let canvas;
let w=400, h=200;
function draw() {
canvas=createCanvas(w,h);
canvas.parent("sketch-dev");
console.log("%c (ツ) # eCoucou "+eC.version+" # ","background: #f00; color: #fff");
}
function draw() {
background(255);
}