___  ___    _ _    _  _ _____   _____
 / __|/ _ \  | | |  | || |_ _\ \ / / __|
| (_ | (_) | |_  _| | __ || | \ V /| _|
 \___|\___/    |_|  |_||_|___| \_/ |___|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Programming art [Tori]

BY: @voraz | CREATED: May 21, 2018, 3:53 a.m. | VOTES: 5 | PAYOUT: $0.00 | [ VOTE ]

Hello, today I want to show you one of my animations. I'm using p5.js.

You can try the code and modify it here (better quality): https://alpha.editor.p5js.org/

Code:

function setup() {
   createCanvas(700, 700, WEBGL);
}

let angle = 0;
let surtax = 0;

function draw() {

   //set lights
   pointLight(155,210,255,50,50,50);
   ambientLight(255);

   background(0);

   //set perspective
   ortho(-500, 500, 500, -500, 0, 1000);
   rotateX(QUARTER_PI);
   rotateY(atan(1/sqrt(2))*1.2);

   //draw toruses
   let surtax = 0;

   for(let x=10; x<400; x+=20) {
       push();
       let ang = angle + surtax;
       rotateX(ang);
       rotateY(ang);
       ambientMaterial(0,255,0,80);
       torus(x, 5, 80, 50);
       pop();
       surtax += 0.27;
   }

   angle += 0.04;
}

TAGS: [ #creativity ] [ #art ] [ #technology ] [ #coding ]

Replies

NO REPLIES FOUND.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>