I saved the processing code into visual studio code as a plain text file, i added the images/gradient.jpg as well as for the logo. I replaced the img code to canvas code and yet no animated logo appears. I have tried everything up to this point and nothing has worked. The logo is just not appearing.
@pjs preload="gradient.jpg,BRICKSxMORTAR_logo_transparentX.png";
PImage gradient;
PImage logo;
void setup(){
size(792, 150);
background(0);
gradient = loadImage("gradient.jpg");
logo = loadImage("BRICKSxMORTAR_logo_transparentX.png");
}
void draw(){
for(int i = 0; i < 10; i++){
float x = random(width);
//ellipse(x, 20, 300, 200);
image(gradient,300,11);
ellipse(x, 200, x, 300);
image(logo,1,9);
//ellipse(x, x, 30, 20);{
}
}
<canvas id="logo" data-processing-sources="BxM_animatedLogo.pde"></canvas>
</div>
It looks like you're trying to conver a sketch from processing-java to processingjs (which is deprecated).
Using the WayBackMachine here is the ProcessingJS
loadImage()reference. Just in case, here's the description:I've emphasised the important part in italics and here's one the example snippets:
Hopefully, in your case it would be a matter of adding the
@pjs preloadcomment:I haven't tested this, but hopefully it works. The source code indicates it should handle multiple images.
As a side note, in the future please post code snippets as formatted text. For HTML/CSS in some cases you can uses stackoverflow's code JS/HTML/CSS snippet feature or if it's simpler/more flexible use one of the many online services such as jsfiddle, codepen, glitch. Sketchpad.cc might also work. Images will take longer to load (and may even cost more money on a mobile device with a data plan) while text is lighter and easier to run/test. Overall it will make it much easier for others to support you.