Fun With Circles

I was in a project yesterday and gave a circle a negative value. The result was a cool shape, so I figured I would share a small project showcasing the result.

function setup()
    print("Hello World!")
    x = 0
    pos = vec2(WIDTH/2,HEIGHT/2)
    parameter.integer("size",20,400,225)
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(0, 0, 0, 255)
    fill(255, 81, 0, 255)
    translate(pos.x,pos.y)
    blendMode(ADDITIVE)
    pushMatrix()
        rotate(x)
        ellipse(0,0,-1*size)
    popMatrix()
    fill(0, 153, 255, 255)
    pushMatrix()
        rotate(2*x)
        ellipse(0,0,-1*size)
    popMatrix()
    x = x + 0.75
end
function touched(t)
    pos.x = t.x
    pos.y = t.y
end

@thebombdiggity You also get some odd circles by having a large circle size. I posted this back in April 2014. Changing the circle size gives different images, but not all values show something. This is for a Retina display. I don’t know if anything will show on a non Retina display.

displayMode(OVERLAY)

function setup()
    parameter.integer("size",20000000,90000000,64659584)
end

function draw()
    background(0)
    noFill()
    stroke(255)
    strokeWidth(2)
    ellipse(WIDTH/2,HEIGHT/2,size)
end

@dave1707 My iPad has a Retina display, but nothing shows up. Strange…

@thebombdiggity Do you see anything when you use the slider to change values. I’m using an iPad Air. Maybe it’s seen only on an iPad Air, because I get different images as I use the slider.

No, I don’t see anything when I use the slider. I’m on an iPad 4th generation so maybe it’s just the fact that the iPad is older

Just have to wait and see if anyone else can see something and what they’re using.

Non retina, iPad mini 1, latest codea release, just get a black screen.

iPad Air 2, dave’s not imagining things, I get a grainy black and white circular pattern

Here’s a video of what I see. The image changes as I move the slider. Not all slider values creates an image.

https://m.youtube.com/watch?v=dUbf8k8rrdc

yep, I get that too

not sure what you can do with it, though

@Ignatz If I’m drawing a circle with a radius of 64,000,000 , why should I be seeing something on the screen at all. @thebombdiggity Sorry for hijacking your discussion. Your program shows that giving functions unusual values sometimes gives interesting results. Try setting up 2 parameters for the 2 sizes of an ellipse in your program. Set the 2 size values to run from -400 to 400 and see what you get as you change the values.

@dave1707 Wow! There are some amazing designs that can be gotten from messing with those parameters! I added more colors and it looks even more amazing. I can’t believe I hadn’t already tried that.

The reason for the differences is because the GPU in the iPad Air 2 and previous generations differ. The extreme size of the circle is probably causing floating-point overflows, and different GPUs handle it differently.

@Simeon Thanks for the explanation. @thebombdiggity Can you post your new program when you get finished.

funny and interesting, a circle a negative value, extreme size

@dave1707 Here you go

displayMode(OVERLAY)
function setup()
    print("Hello World!")
    x = 0
    pos = vec2(WIDTH/2,HEIGHT/2)
    parameter.watch("math.floor(1/DeltaTime)")
    parameter.integer("size",-400,400,225)
    parameter.integer("size2",-400,400,225)
    colors = {
    color(255, 81, 0, 255),
    color(0, 153, 255, 255),
    color(215, 0, 255, 255),
    color(0, 255, 64, 255),
    color(0, 255, 205, 255),
    color(107, 0, 255, 255),
    }
    parameter.integer("amount",1,#colors,2)
end
-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(0, 0, 0, 255)
    translate(pos.x,pos.y)
    blendMode(ADDITIVE)
    for i = 1,amount do
        create(0,0,i*x,colors[i])
    end
    x = x + 0.75
end
function create(x1,y1,r,c)
    pushMatrix()
    pushStyle()
        fill(c)
        rotate(r)
        ellipse(x1,y1,-1*size,-1*size2)
    popStyle()
    popMatrix()
end
function touched(t)
    pos.x = t.x
    pos.y = t.y
end  

Nice job. Really shows some interesting designs.

I need help with a delay fx, PGM runs at 60fps a sec. I would like to slow it down with a time elapsed fx

-- Ellipse

function setup()
    ellipseMode(CENTER)
    displayMode(FULLSCREEN)
    t=ElapsedTime
end

function draw()
    background(0)
    t=t+2
    -- Draw a random color 
    fill(math.random(255),math.random(255),math.random(255))
    -- Line thickness
    strokeWidth(3)
    -- Color stroke(41, 21, 196)
    -- Shape location along the x, y axis ;
    -- Size along the x, y axis
    ellipse(400,200,300,200)
end

Here your code with a 2 second delay.

displayMode(FULLSCREEN)

function setup()
    ellipseMode(CENTER) 
    strokeWidth(3)
    t=ElapsedTime
end

function draw()
    background(0)
    if ElapsedTime>t+2 then      -- 2 second delay
        colr=color(math.random(255),math.random(255),math.random(255))
        fill(colr)
        t=ElapsedTime
    end
    ellipse(400,200,300,200)
end

Is there any trick to make the ellipse stay on the screen instead of being cleared away by the background CMD ?..