Hi,
I'm new to Processing but eager to learn.
What I'm trying to achieve:
Placing an image randomly around the edge of the canvas. Like a border.
I have tried doing this with for loops but cannot combine them into the overall solution.
I believe the border structure is
when x = 0 to width
then y = 0
y = 0 to height
then x = 0.
What I have so far:
I'm new to Processing but eager to learn.
What I'm trying to achieve:
Placing an image randomly around the edge of the canvas. Like a border.
I have tried doing this with for loops but cannot combine them into the overall solution.
I believe the border structure is
when x = 0 to width
then y = 0
y = 0 to height
then x = 0.
What I have so far:
- PImage img;
- int UNIT = 8;
- int M = 2*UNIT;
- int pageWidth = 500;
- int pageHeight = 500;
- float x = 0;
- float y = 0;
- void setup(){
- size(pageWidth+2*M, pageHeight+2*M);
- background(255);
- img = loadImage("image.jpg");
- }
- void draw() {
- float x = pageWidth;
- if(x == pageWidth) {
- y = random(pageHeight);
- }
- if(mousePressed == true) {
- background(255);
- imageMode(CORNERS);
- image (img, x, y);
- }
- }
Thank you in advance,
Lrs
Lrs
1