INNER CODE UNIT · JavaScript

setup

ren-yuan/c2.js · examples for p5.js/ArcField.js:6

function setup() {
    createCanvas(960, 540);
    colorMode(HSL, 100);
    ellipseMode(RADIUS);

    world = new c2.World(new c2.Rect(0, 0, width, height));

    for(let i=0; i<100; i++){
        let x = random(width);
        let y = random(height);
        let p = new c2.Particle(x, y);
        p.radius = random(10, height/14);
        p.color = color(random(0, 8), random(30, 60), random(20, 100));

        world.addParticle(p);
    }

    let collision = new c2.Collision();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…