Advertisement
Mr_jack

p5.js Render test

Apr 17th, 2024
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.36 KB | Source Code | 0 0
  1. function setup() {
  2.   createCanvas(400, 400);
  3.   frameRate(60);
  4. }
  5.  
  6. function draw() {
  7.   time = millis() / 1000.0;
  8.   background(0);
  9.  
  10.   hw = width/2;
  11.   hh = height/2;
  12.  
  13.   t = time * 4.0;
  14.  
  15.   x = 1 + 0.5 * Math.sin(t);
  16.   y = 1 + 0.5 * Math.cos(t);
  17.   s = 0.75 + 0.25 * Math.cos(t/2.0);
  18.  
  19.   fill(255);
  20.   circle(hw * x, hh * y, min(hw, hh)*0.75 * s);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement