r/ComputerCraft • Computercraft graphics research • Sep 24 '22

Fractals !

66 Upvotes

4 comments sorted by

3

u/9551-eletronics Computercraft graphics research Sep 24 '22

source code (made using LoveCC)

love.cc.quantize(true)
love.cc.dither(true)
local w,h = love.graphics.getDimensions()

local sx = 5000

love.cc.quantize(true)
love.cc.dither(true)
local w,h = love.graphics.getDimensions()

local sx = 5000

function love.draw()
    for y=1,h do
        for x=1,w do
            local dx = (x - 500) / sx - 0.12
            local dy = (y - 500) / sx - 0.82
            local a,b = dx,dy
            for t=1,200 do
                local d = a^2 - b^2 + dx
                b = 2*(a*b) + dy
                a = d
                if d > 200 then
                    love.graphics.setColor(
                        love.cc.clamp_color((t*3)/256,8),
                        love.cc.clamp_color(t/256,8),
                        love.cc.clamp_color((t*0.5)/256,8)
                    )
                    love.graphics.points(x,y)
                    break
                end
            end
        end
    end
end

function love.wheelmoved(dx,dy)
    sx = sx + dy * 100
end

3

u/ex-p--a---n----d Sep 24 '22

Wow! That's really impressive, congratulations!