FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   newbe question
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: newbe question  (Read 257 times)
kuulio


newbe question
« on: Feb 6th, 2004, 10:15am »

I want to rotate an bitmap image that I have loaded.
How can I do it easily?
 
thanks
kuulio
 
kevinP

Email
Re: newbie question
« Reply #1 on: Feb 6th, 2004, 12:09pm »

Hi,
 
Check out the rotate() command. You'll see in the example in the Reference section that you'll first want to use translate(). This moves your coordinate starting point (0, 0) to your intended centerpoint of rotation. (rotate uses 0,0). rotate() also expects to see radians not degrees (TWO_PI is 360 deg., PI is 180, etc.).
 

Kevin Pfeiffer
ramastar
Guest
Email
Re: newbe question
« Reply #2 on: Feb 8th, 2004, 7:34pm »

What's wrong with this script? It doesn't rotate the image, but draws a new image on top of the previous and builds the rotation like this in frames...
 
I just want to rotate the loaded image.
 
 
BImage img;  
float angle;
 
void setup(){
  size(200,200);
  background(200);
  smooth();
   
  img = loadImage("test.jpg");  
  imageMode(CENTER_DIAMETER);
}
 
void loop(){
  angle += 0.08;
  translate(width/2,height/2);
  rotateZ(angle);
  image(img, 0, 0);
}
 
arielm

WWW
Re: newbe question
« Reply #3 on: Feb 8th, 2004, 8:43pm »

try to move "background(200)" which is currently inside "setup()" to the beginning of "loop()"
 
(the syntax you used was working once, but it was around version 059...)
 

Ariel Malka | www.chronotext.org
Pages: 1 

« Previous topic | Next topic »