Fireball

Circular conflagration

Log in to post a comment.

Canvas.setpenopacity(-0.05);
const size = 130;
const particles = 3000;
const minParticleSize = 1;
const maxParticleSize = 10;
const minParticleSpeed = 0.5;
const maxParticleSpeed = 10;
const particleStep = 0.1;

function walk(i) {
    const turtle = new Turtle();
    const pSize = minParticleSize+(maxParticleSize-minParticleSize)*Math.random();
    const pSpeed = minParticleSpeed+(maxParticleSpeed-minParticleSpeed)*Math.random();
    turtle.penup();
    turtle.goto(-maxParticleSize+2*maxParticleSize*Math.random(), -maxParticleSize+2*maxParticleSize*Math.random());
    turtle.seth(i*Math.log10(i));
    turtle.forward(i/particles*size);
    for (let j = 0; j < pSpeed; j+=particleStep) {
        const [x, y] = turtle.pos();
        const h = turtle.h();
        turtle.pendown();
        turtle.circle(pSize, 180, 10);
        turtle.penup();
        turtle.setpos(x, y);
        turtle.seth(h);
        turtle.forward(particleStep);
    }
    return i < particles;
}