Rotating a gradient
in
Programming Questions
•
1 year ago
Hello everybody,
I'm new in Processing I just start to learn some days ago and I have been programming in AS3 from sometime before
I’m trying to rotate a element with a gradient here is my code:
- public PincelMar pincelmar;
- void setup()
- {
- size(600, 600);
- smooth();
- frameRate(30);
- background(255);
- noFill();
- pincelmar = new PincelMar();
- }
- void draw()
- {
- pincelmar.pintar();
- }
I created a Class becouse I was planning to rotate the whole class like I would do it in AS3, but I realice that in Processing is not possible
//----------- Class -------->
- class PincelMar {
- float x;
- int wCanvas = width/2;
- int hCanvas = height/2;
- PincelMar() {
- x=0;
- }
- void pintar()
- {
- x ++;
- translate(wCanvas, hCanvas);
- /*
- Here is where I rotate what it comes after: the collection of points that forms the gradient
- */
- rotate(radians(-x));
- for (int i = 30; i < 300; i++) {
- for(int j = 20; j < 100; j++) {
- color c = color(204-j, 153-i, 0);
- set(i, j, c);
- }
- }
- }
- void actualiza()
- {
- pintar();
- }
- }
I guess that this is so easy to do, but I don’t know how to do it right now
Can anyone give an idea?
Salutations,
Goza
1