Jump to content

inserting java code made in processing

Recommended Posts

I made a code in processing thats java. I'm having problems finding any resources or tutorials on how to put it into my site. If its even possible. 

I go into "Pages" > "Page Settings" > "Advanced" inject code here. It doesn't work. The code itself just shows up on the page. Another thing is that this code basically uses the mouse to control an image. So the image needs to be uploaded as well. Could I put my Java code into CSS? Again this is Java, not JavaScript. 

Any help would be appreciated. See code below.


PImage img; 

void setup() {
  size(1440, 810);
  img = loadImage("test4.jpg");
  img.resize (1440, 810);

void draw() {
  float tiles = mouseX/2;
  float tileSize = width/tiles;
  translate(tileSize/2, tileSize/2);
  for (int x = 0; x < tiles; x++) {
    for (int y = 0; y < tiles; y++) {
      color c = img.get(int(x*tileSize), int(y*tileSize));
      float size = map(brightness(c), 255, 0, 0, 3);    
      ellipse(x*tileSize, y*tileSize, size, size);

Link to comment
  • Replies 0
  • Views 424
  • Created
  • Last Reply


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.