FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Teaching
   Theory and Practice
(Moderators: REAS, arielm)
   Quick Bits : STATIC FORM - 4
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Quick Bits : STATIC FORM - 4  (Read 1685 times)
arielm


WWW
Quick Bits : STATIC FORM - 4
« on: Mar 2nd, 2004, 11:32pm »

SF4_001
 
Code:
// ITERATIVE DRAWING/1D
 
for(int x = 0; x < 100; x = x + 10)
{
  line(x, 0, x, 50);
}
 
stroke(255, 0, 0);  // red
 
for(int y = 50; y < 100; y = y + 5)
{
  line(0, y, 100, y);
}
 

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #1 on: Mar 2nd, 2004, 11:32pm »

SF4_002
 
Code:
// ITERATIVE DRAWING/USING FUNCTIONS 1
 
void setup()
{
  size(200, 200);
  background(255, 255, 255);
}
 
void draw()
{
  for(int x = 0; x < 200; x = x + 50)
  {
    cross(x, x);
  }
}
 
void cross(float x, float y)
{
  noStroke();
  fill(255, 0, 0);
  rectMode(CENTER_DIAMETER);
 
  rect(x, y, 30, 10);    
  rect(x, y, 10, 30);
}
 

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #2 on: Mar 2nd, 2004, 11:34pm »

SF4_003
 
Code:
// ITERATIVE DRAWING/SCALING
 
for (float s = 0; s < 1; s = s + 0.1)
{
  line(s * 50, 0, s * 50, 40);
}
 
stroke(255, 0, 0); // red
 
float s = 0;
for (float i = 0; i < 10; i = i + 1)
{
  line(s, 40, s, 40 + i * 5);
  s = s + 5;
}
 

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #3 on: Mar 2nd, 2004, 11:35pm »

SF4_004
 
Code:
// ITERATIVE DRAWING/USING FUNCTIONS 2
 
void setup()
{
  size(200, 200);
  background(255, 255, 255);
}
 
void draw()
{
  fill(255, 0, 0);
 
  float s = 0.25;
  for(int x = 0; x < 200; x = x + 20)
  {
    cross(x, x, s);
    s = s + 0.1;
  }
}
 
void cross(float x, float y, float sz)
{
  noStroke();
  rectMode(CENTER_DIAMETER);
 
  rect(x, y, 30 * sz, 10 * sz);    
  rect(x, y, 10 * sz, 30 * sz);
}
 

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #4 on: Mar 2nd, 2004, 11:37pm »

SF4_005
 
Code:
// ITERATIVE DRAWING/EMBEDDED LOOPS
 
for (int y = 10; y < 100; y = y + 10)
{
  for (int x = 10; x < 100; x = x + 10)
  {
    point(x, y);
  }
}
 

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #5 on: Mar 2nd, 2004, 11:38pm »

SF4_006
 
Code:
// ITERATIVE DRAWING/COLOR-GRADIENT
 
for (float r = 0; r < 100; r = r + 1)
{
  stroke(r * 2.55, 0, 0);
  line(r, 0, r, 100);
}
« Last Edit: Mar 2nd, 2004, 11:39pm by arielm »  

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #6 on: Mar 2nd, 2004, 11:40pm »

SF4_007
 
Code:
// ITERATIVE DRAWING/ITERATING OVER AN ITERATIVE FUNCTION
 
void setup()
{
  size(200, 200);
  background(0, 0, 0);
}
 
void draw()
{
  float y = 0;
  for(int n = 1; n < 11; n++)
  {
    row(n, y);
    y = y + 20;
  }
}
 
void row(int n, float y)
{
  noStroke();
  fill(255, 0, 0);
 
  for(int i = 0; i < n; i++)
  {
    ellipse(i * 20, y, 16, 16);
  }
}
 

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #7 on: Mar 2nd, 2004, 11:42pm »

SF4_008
 
Code:
// ITERATIVE DRAWING/USING MATRIX TRANSFORMS 1
 
background(0, 0, 0);
noStroke();
ellipseMode(CENTER_RADIUS);
fill(255, 0, 0); // red
 
translate(50, 50); // go to the center of the screen
for (int i = 0; i < 12; i++)
{
  push();
  rotate(i * TWO_PI / 12); // rotate by 1/12 of a round
  translate(40, 0); // 40 is the diameter of the clock
  ellipse(0, 0, 4, 4);
  pop();
}
 
stroke(255, 255, 255); // white
rotate(radians(60));  // 60 degrees
line(0, 0, 40, 0);
 

Ariel Malka | www.chronotext.org
arielm


WWW
Re: Quick Bits : STATIC FORM - 4
« Reply #8 on: Mar 2nd, 2004, 11:43pm »

SF4_009
 
Code:
// ITERATIVE DRAWING/USING MATRIX TRANSFORMS 2
 
void setup()
{
  size(200, 200);
  background(160);
}
 
void draw()
{
  push();
  fill(0); // black
  translate(100, 100);
  scale(1.5);
  escargot();
  pop();
 
  push();
  fill(255); // white
  translate(50, 40);
  escargot();
  pop();
 
  push();
  fill(255, 204, 51); // bronze
  translate(140, 160);
  scale(0.8);
  rotate(radians(90));
  escargot();
  pop();
}
 
void escargot()
{
  noStroke();
  ellipseMode(CENTER_RADIUS);
 
  float x = 0;
  float angle = 0;
 
  for(int i = 1; i < 100; i++)
  {
    push();
    rotateZ(angle);
    triangle(x, - 5, x - 5, 5, x + 5, 5);
 
    angle += radians(12);
    x += 0.4;
    pop();
  }
}
« Last Edit: Mar 2nd, 2004, 11:44pm by arielm »  

Ariel Malka | www.chronotext.org
Pages: 1 

« Previous topic | Next topic »