Raymond Pai-Project-04

sketch

//Raymond Pai
//Section D
//rpai@andrew.cmu.edu
//Project 04

var rx1;
var ry1;
var rx2;
var ry2;

var lx1;
var ly1;
var lx2;
var ly2;

var bx1;
var by1;
var bx2;
var by2;

var tx1;
var ty1;
var tx2;
var ty2;

function setup() {
    createCanvas(400, 300);
    //initiate r curve
    rx1 = 0;
    ry1 = -150;
    rx2 = 0;
    ry2 = height;

    //initiate l curve
    lx1 = 20;
    ly1 = -150;
    lx2 = 20;
    ly2 = height;

    //initiate b curve
    bx1 = -20;
    by1 = -150;
    bx2 = -20;
    by2 = height;

    //initiate l curve
    tx1 = -50;
    ty1 = -150;
    tx2 = -50;
    ty2 = height;
}

function draw() {
    background(220, 220, 150);

    //triangle
    fill(100);
    triangle(width/2, height, width/2 + width/4, height/2, width, height);
    fill(255);
    triangle(width/2 + 35, height - 50, width/2 + width/4, height/2, width - 35, height - 50);

    //r curve
    for (var a = 0; a < 1000; a += 10) {
        stroke(50, 50, 255);
        line(rx1, ry1 + a, rx2 + a, ry2);
    }
    //l curve
    for (var a = 0; a < 1000; a += 10) {
        stroke(255);
        line(lx1, ly1 + a, lx2 + a, ly2);

    }
    //b curve
    for (var a = 0; a < 1000; a += 10) {
        stroke(100, 100, 255);
        line(bx1, by1 + a, bx2 + a, by2);
    }
    //t curve
    for (var a = 0; a < 1000; a += 10) {
        stroke(0, 0, 255);
        line(tx1, ty1 + a, tx2 + a, ty2);
    }
}

Drawing of a wave. The white foam and the dark blue are shown using a gradient of 4 ‘curves’.

Image result for tsunami painting
Reference

Leave a Reply