1

I have a very simple code in Processing (it can be found in Visualizing Data by Ben Fry):

  void setup() {
  size(400,400);
  stroke(225);
  
}
void draw(){
  line(15,25,mouseX,mouseY);
  
}
void mousePressed(){
  background(192,64,0);
}

But when I go to Files, Export, it creates a folder in my sketch folder named "macos-x86_64" and not the desired folder "applet" with the html file "index.html" as stated in the book (page 23). I want to open my sketches in a browser but I don't know why the html file is not being created.

Thanks for the help

Cadin
  • 4,275
  • 1
  • 14
  • 22
Santiago
  • 11
  • 1

1 Answers1

1

That book is pretty old, so you are getting outdated instructions.

I don't think it's possible to export a web applet from Processing anymore, since most browsers no longer support them.

If you want to run your sketches online, you might want to look into the Javascript version of Processing, p5.js. You can set the Processing app to use p5.js by changing the Mode dropdown in the top right. The syntax for everything will be slightly different though, so you may want to find a book that covers p5.js specifically:

 function setup() {
  createCanvas(400,400);
  stroke(225);
  
}
function draw(){
  line(15,25,mouseX,mouseY);
  
}
function mousePressed(){
  background(192,64,0);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.1/p5.min.js"></script>

There are some listed here.

George Profenza
  • 50,687
  • 19
  • 144
  • 218
Cadin
  • 4,275
  • 1
  • 14
  • 22