Posts

Showing posts from September, 2019

HW#7

Image

HW#6

//FAN LAN, HW#6, 9/23/19, //Reference: https://www.youtube.com/watch?v=IKB1hWWedMk int cols, rows; int scl=20; int w=2000; int h=1600; float flying=0; float[][] terrain; void setup() {   size(600, 600, P3D);   cols=w/scl;   rows=h/scl;   terrain = new float[cols][rows];   }   void draw() {          flying += 0.01;            float yoff=flying;   for (int y=0; y<rows; y++) {       float xoff=0;     for (int x=0; x<cols; x++) {       terrain[x][y]=map (noise(xoff, yoff), 0, 1, -100, 80);       xoff+=0.1;     }     yoff+=0.1;   }          background(0);     stroke(255);     noFill();     translate(width/2, height/2+50);     rotateX(PI/3);     translate(-w/2, -h/2)...

HW#5A

//FAN LAN //HW#5A //September 18, 2019 ------------------------------------------------------------- Draw Line Grid background(0); strokeWeight(1); stroke(255); size(600, 400); int x=0;//initialized condition while (x<width) { //boolean expression line(x,0,x,height); x=x+20; //incrementationn operation } for(int y=0; y<width; y=y+20){ line (0,y,width, y); } ------------------------------------------------------------ Draw Box Grid   size(600, 400);   background(0);   strokeWeight(1);   fill(0);   stroke(255);   for (int x=0; x<width; x=x+20) {     for (int y=0; y<height; y=y+20) {       rect(x, y, 20, 20);     }   } ------------------------------------------------------------- Draw Point Grid background(0); strokeWeight(1); stroke(255); size(600, 400);   for (int x=0; x<width; x=x+20) {     for (int y=...

HW#5B

//FAN LAN //HW#5B //September 18, 2019 void setup() {   size(600, 480);   //background(255, 208, 126);   noStroke();    smooth(); } void draw() {   background(204);   randomSeed(0);   for (int i = 20; i < width; i += 40) {     int green = int(random(0, 150));     float scalar = random(0.25, 1.0);     drawTree(i, 110, green, scalar);   } } void  drawTree(int x, int y, int green, float s) {   pushMatrix();   translate(x, y);   scale(s);  // Set the float sacle   //draw trunk   color trunkcolor = color(161, 113, 64);    fill(trunkcolor);   rectMode(RADIUS);   int a=50;    int b=320;    rectMode(RADIUS);   int trunkWeight=6;    int trunkHeight=35;    rect(a, b, trunkWeight, trunkHeight);      //draw canopy   color r = ...

HW#4 revised

//FAN LAN //HW#4 revised //September 18, 2019 //for cloud movement float circleX=0; float xspeed = 10;  void setup() {   size(600, 600);   //background(255, 208, 126);   noStroke();    smooth(); } void draw() {   drawSky();   drawLandform();   drawTrees();   drawSun();   drawClouds(); } void drawSky() {   color skycolor = color(13, 238, 252); //use the colour yellow   fill(skycolor);        rect(0, 0, width, height/2); } void drawLandform() {   color landcolor = color(252, 252, 215);    fill(landcolor);        rect(height/2, 0, width, height/2); } void  drawTrees() {   //draw trunk   color trunkcolor = color(161, 113, 64);    fill(trunkcolor);   rectMode(RADIUS);   for (int x=50; x < width-50; x+=70) {     int y=320;      r...

HW#4

//FAN LAN //HW#4  //September 16, 2019 float y = 20; //for sun movement float circleX=0; float xspeed = 10; //for cloud movement void setup() {   size(1200, 580);   //background(255, 208, 126);   noStroke();    smooth(); } void draw() {   drawSky();   drawSun();   drawLawn();   drawMountain();   drawRiver();   drawRoad();   drawCloud();   drawTree(); } void drawSky() {   //color gradient   noStroke();   color orange = color(255, 208, 126);   color yellow = color(252, 252, 215);   int gradientSteps = 50; //set up pixel step detail, how detailed will the gradient be   int gradientStripHeight = height/gradientSteps;//how many strips of the same height    for (int i = 0; i < gradientSteps; i++) {//for repeat each gradient strip     float t = map(i, 0, gradientSteps, 0, 2);//map(value, start1, stop1...

HW#3-b

Fan Lan, 3rd-MLA, HW#3-b, Sep. 11,19 float y = 20; //for sun movement float Xspeed = 10; //for cloud movement void setup() {   size(1200, 580);   //background(255, 208, 126);   noStroke();   smooth(); } void draw() {   //draw sky color gradient   noStroke();   color orange = color(255, 208, 126);   color yellow = color(252, 252, 215);   int gradientSteps = 50; //set up pixel step detail, how detailed will the gradient be   int gradientStripHeight = height/gradientSteps;//how many strips of the same height   for (int i = 0; i < gradientSteps; i++) {//for repeat each gradient strip     float t = map(i, 0, gradientSteps, 0, 2);//map(value, start1, stop1, start2, stop2)- compute how far to start color change     //this value will plug into lerpColor which does the colour interpolation for you     color interpolatedColor = lerpColor(orange, yellow, t);     //Syntax...

HW#3 - a

HW#3, Fan Lan, MLA 3rd-yr, Sep. 7 void setup(){   size(620, 620);   smooth();   fill(102);   noStroke(); } void draw() {   background(204);    fill(0,0,0);   stroke(2);      float diameter = pmouseX+100;   int y=310;   int x=310;   ellipse (x, y, diameter, diameter);   }