How to rotate the buttons in Processing

139 Views Asked by At

I have 24 buttons that will shape a circle together.

So, the image of the buttons should look in a rotating way like this:

enter image description here

I want to use the same 3 images (setImages(); 3 images for 3 mouseClick conditions in 1 button) in each of them. I thought I could maybe rotate the buttons instead of loading new images.

Is there any way to rotate the buttons? Or could you give me an idea like what would be the most logical way to do this?

Here is my code:

  for(int i=0; i<3; ++i){
    (imgden1[i] = loadImage("den" + i + ".png")).resize(20,20);} //the same 3 images for all the buttons
    
  for(int k=1; k<25; ++k){  //24 buttons in total
    cp5.addButton("Button" + k)  // The button
    .setPosition((50+40*k),140)  //I will set the algorithm for position later when I solve the rotation problem
    .setImages(imgden1)
    .updateSize()
    .setSize(20, 20)       // (width, height)
    .setFont(font)
    .moveTo(AreaRingGroup);
  
    
  }   // add it to the group 
  ; 
0

There are 0 best solutions below