We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Re: Replacing cursor
Page Index Toggle Pages: 1
Re: Replacing cursor (Read 922 times)
Re: Replacing cursor
Apr 19th, 2007, 9:36pm
 
this should help

float x = 100;
float y = 100;
// Background colour
PImage b;
// Declare variable "a" of type PImage
PImage a;
void setup() {
 // Background size
 size(420, 280);  
 // Load the images into the program  
 a = loadImage("rainbow.png");
 b = loadImage("background.png");

 noCursor();
}
void draw() {
 // Background colour
 background(b);
 fill(0);
 pushMatrix();
 translate(mouseX,mouseY);
 rotate(rotateValue);
 // Displays the image from point (0,0)
 image(a, 0, 0);
 popMatrix();
}
Re: Replacing cursor
Reply #1 - Apr 19th, 2007, 9:45pm
 
Does rotateValue not have to equal/reference something?
Re: Replacing cursor
Reply #2 - Apr 21st, 2007, 10:26pm
 
No? Cause its not rotating ...
Re: Replacing cursor
Reply #3 - Apr 22nd, 2007, 1:32pm
 
rotatewValue is a value you need to create, and modify each frame by some ammount.
Re: Replacing cursor
Reply #4 - Apr 29th, 2007, 6:25pm
 
So will that value have to reference another value which is constantly changing with every frame?

ie. rotate(rotatevalue); - and "rotatevalue" equaling the rotate value?

If so, how do I best accomplish a value that changes every frame that will make the image constantly rotate?
Re: Replacing cursor
Reply #5 - Apr 29th, 2007, 6:37pm
 
Code:
float rotateValue;

void setup()
{
...
rotateValue=0;
}

void draw()
{
rotateValue+=0.1;
...
rotate(rotateValue);

}
Re: Replacing cursor
Reply #6 - Apr 29th, 2007, 8:40pm
 
Is there any way to have it rotate from the center axis?
Re: Replacing cursor
Reply #7 - Apr 29th, 2007, 8:56pm
 
do: image(a,-a.width/2,-a.height/2);
Re: Replacing cursor
Reply #8 - Apr 30th, 2007, 12:12am
 
Thank you!
Page Index Toggle Pages: 1