Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num = 10;
- float offset, step;
- Linn[] lines = new Linn[num];
- color bg = #EDC951;
- color f = #CC333F;
- color s = #EB6841;
- void setup() {
- size(500, 500);
- background(bg);
- stroke(s);
- noStroke();
- float y = 50;
- float theta = 0;
- step = (height-2*y)/num;
- println(step);
- for (int i=0; i<num; i++) {
- lines[i]= new Linn(y, theta);
- y += step;
- theta += TAU/num ;
- }
- }
- void draw() {
- background(bg);
- for (int i=0; i<lines.length; i++) {
- lines[i].display();
- }
- if (frameCount % 2 == 0 && frameCount<121) saveFrame("image-####.gif");
- }
- class Linn {
- float offset, theta, y;
- Linn(float _y, float _theta) {
- y = _y;
- theta = _theta;
- }
- void display() {
- offset = map(sin(theta), -1, 1, -50, width/3);
- float a =map(cos(theta), -1, 1, 50, 200);
- strokeWeight(2);
- fill(f, a);
- rect(50, y, (width/2-50)-offset, step);
- rect(width/2+offset, y, width/2-50-offset, step);
- theta += 0.0523;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement