Rotate Image
in
Programming Questions
•
3 years ago
Hi all,
I'm new to processing, and I'm trying to rotate an image
randomly using the image(name, x,y) function. I would like to declare a float globally that uses "random" to generate a value from 0-360 (I'll convert to radians w/ function) and then flip an image to that rotation. The issue is, I don't know how to rotate an image - The parameters are only (x,y,width,height). Any help on this? My current code:
- // Declare Global Variables + Images
- PImage bg;
- PImage image_1;
- float imageRotation = random(360);
- void setup() {
- // Images (Import)
- bg = loadImage("bg.jpg");
- image_1 = loadImage("image_1.png");
- // Fonts (Import)
- // (use textFont(fontName); THEN text("ExampleText", PosX, PosY, Width, Height);
- // geo = loadFont("importedfontName");
- size(800,800);
- frameRate(3);
- image(bg,0,0);
- }
- void draw() {
- image(image_1, mouseX, mouseY);
- }
1