Realistic cartoon fire!

So after finding out how to make a glow pen, the method I used has also helped to make a few other things as it gives a really nice look, and with a bit of tweaking I managed to get some really cool looking fire. You can change the size and colour of it and adjust the wind by sliding your finger from left to right on the screen.


--# Main
function setup()
    --screen = image(WIDTH,HEIGHT)
    parameter.integer("size",5,100)
    
    cap = image(100,100)
    setContext(cap)
        pushStyle()
            local mp = 255/100
            for i=1,400 do
            fill(255,255,255,1)
            ellipse(50,50,i/4)
            end
        popStyle()
    setContext()
    
    m = mesh()
    m.texture = cap
    part = {}
    i=0
    parameter.color("colour",color(200,255,0,80),function() m:setColors(colour) end)
    m:setColors(colour)
    emitpos = vec2(WIDTH/2,HEIGHT/2-200)
end


function draw()
    if i <= 400 then 
        i = i + 1
        part[i] = {}
        part[i].pos = vec2(WIDTH/2,HEIGHT/2)
        part[i].vel = vec2(math.random(-2,2)*2,math.random(-2,2))
        part[i].time = 0.5
        part[i].size = math.random(20,40)+size
        part[i].r = m:addRect(WIDTH/2,HEIGHT/2,1,1)
        m:setColors(colour)
    end
    background(77, 70, 70, 255)
    for i=1,#part do
        local p = part[i].pos
        part[i].pos = p+part[i].vel
        p = part[i].pos
        part[i].vel = part[i].vel+vec2((emitpos.x-p.x)/300-part[i].vel.x/15,0.005*part[i].size)
        part[i].time = part[i].time-0.01
        local t = part[i].time
        m:setRect(part[i].r,p.x,p.y,part[i].size*t*2,part[i].size*t*2)
        if t<=0 then
            part[i].pos = vec2(WIDTH/2,HEIGHT/2)
            part[i].vel = vec2(math.random(-2,2),math.random(-2,2))
            part[i].time = 0.5
            part[i].size = math.random(20,40)+size
        end
    end
    blendMode(ADDITIVE)
    m:draw()
end

function touched(t)
    emitpos = emitpos + vec2(t.deltaX,t.deltaY)
end

Very nice effect @luatee. Orange gives a nice meteorite. Very fast too.

cool