Rotate function

Anyone knows how i can rotate an object starting from its x,y position without moving it like with the rotate function?

@Drea I’ve read that several times, but I still don’t know what you want to do. Can you give more details on what you mean.

I mean like the clock hands, they rotate on a single point

Like this.

function setup()
    a=0
end

function draw()
    background(40, 40, 50)
    a=a+1
    translate(300,300)
    rotate(a)
    sprite("Small World:Icon",0,0)    
end

It works with that sprite, but for example if i wanted to create a line (350,250,350,500) and then rotate

Ops a part of my message was delated… i was saying and then rotate without changing the initial x and y positions, how should i do?

function setup()
    a=0
end

function draw()
    background(40, 40, 50)
    a=a+1
    translate(WIDTH/2,HEIGHT/2)
    rotate(a)
    stroke(255,0,0)
    strokeWidth(4)
    line(0,0,200,0)
end

Yess, i also did something really similar but i didn’t realize that it rotated starting from 0,0, that s why i couldn’t do it right. Thank you so much dave!

Since you mentioned clock hands above, I thought I’d throw this in.

function setup()
    a=0
    b=0
    fontSize(50)
end

function draw()
    background(40, 40, 50)    
    fill(223, 204, 170, 255)
    ellipse(WIDTH/2,HEIGHT/2,430)
    fill(255)
    text("12",WIDTH/2,HEIGHT/2+180)
    text("6",WIDTH/2,HEIGHT/2-180)
    text("3",WIDTH/2+180,HEIGHT/2)
    text("9",WIDTH/2-180,HEIGHT/2)    
    a=a-1
    pushMatrix()
    translate(WIDTH/2,HEIGHT/2)
    rotate(a)
    stroke(255,0,0)
    strokeWidth(6)
    line(0,0,0,200)
    popMatrix()    
    pushMatrix()
    translate(WIDTH/2,HEIGHT/2)
    rotate(a/12)
    strokeWidth(12)
    line(0,0,0,120)
    popMatrix()
    noStroke()
    fill(255)
    ellipse(WIDTH/2,HEIGHT/2,30)    
    noFill()
    stroke(0, 56, 255, 255)
    strokeWidth(8)
    ellipse(WIDTH/2,HEIGHT/2,430)
end

Nice job man