FPS dial

I had nothing better to do, so here’s some useless code. It’s a frames per second dial. Slide the parameter to change the for loop value to put a load on the draw function. You can change the x,y position, the radius of the circle, and the step value for the dial numbers. I don’t see a real use for this, but it was something to do.

function setup()
    parameter.integer("val",0,20,2)
    lineCapMode(SQUARE)
end

function draw()
    background(0)
    fps=1/DeltaTime
    fpsDial(WIDTH/2,HEIGHT/2,400,fps,2)
    for z=1,val*100000 do
        s=math.sqrt(z)
    end
end

function fpsDial(x,y,r,f,s)   -- x-pos, y-pos, radius, fps, step
    pushMatrix()
    pushStyle()
    noFill()
    stroke(255, 0, 0, 255)
    strokeWidth(15)    
    ellipse(x,y,r)    
    translate(x,y)
    rotate(f*5)
    stroke(0, 255, 0, 255)
    strokeWidth(5)
    line(0,0,r/2-15,0)
    popStyle()
    popMatrix()
    fill(0, 70, 255, 255)
    ellipse(x,y,45)
    fill(255)
    text(string.format("%.1f",f),x,y)
    for z=0,70,s do
        sx=math.cos(math.rad(z*5))*(r/2+10)
        sy=math.sin(math.rad(z*5))*(r/2+10)
        text(z,x+sx,y+sy)
    end    
end

@dav1707 I think it’s great and I think the idea could be used for debugging, to slow down the action to help see what’s going on.