{"size": 836, "ext": "js", "max_stars_repo_path": "2_Dev/a002/js/sketch.js", "max_stars_repo_name": "e-coucou/P5js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "2_Dev/a002/js/sketch.js", "max_issues_repo_name": "e-coucou/P5js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "2_Dev/a002/js/sketch.js", "max_forks_repo_name": "e-coucou/P5js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.9, "max_line_length": 71, "alphanum_fraction": 0.5322966507}
 let canvas;

let gravity;
let ressorts = [];
let points = [];
let inter = 2;

function setup() {
    canvas = createCanvas(600, 800);
    canvas.parent('sketch-XXX');
    gravity = createVector(0,0.05);
    colorMode(HSB);
    for (let i=0; i<80 ; i ++) {
        points.push(new Particule(300, inter*i));
        if (i!==0) {
            ressorts.push(new Ressort(0.4,inter,points[i-1],points[i]))
        }
    }
    points[0].fixe = true;
    // points[points.length-1].fixe = true;
}

function draw() {
    background(0);

    if (mouseIsPressed) {
        points[points.length-1].pos.set(mouseX,mouseY);
        points[points.length-1].vel.set(0,0);
    }

    for (r of ressorts) {
        r.update();
        r.show();
    }
    for (p of points) {
        p.applyForce(gravity);
        p.update();
        // p.show();
    }
}