Advertisement
Guest User

Seizure Simulator

a guest
Dec 6th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. This is p5js
  2. Use this to have a seizure
  3.  
  4. //Ball 1
  5. var Ball1 = {
  6.   x : 200,
  7.   y : 150,
  8.   xS : 5,
  9.   yS : 5
  10. };
  11.  
  12. //Ball 2
  13. var Ball2 = {
  14.   x : 300,
  15.   y : 100,
  16.   xS : 5,
  17.   yS : 5
  18. };
  19.  
  20. //Ball 3
  21. var Ball3 = {
  22.   x : 325,
  23.   y : 250,
  24.   xS : 5,
  25.   yS : 5
  26. };
  27.  
  28. //Ball 4
  29. var Ball4 = {
  30.   x : 250,
  31.   y : 50,
  32.   xS : 5,
  33.   yS : 5
  34. };
  35.  
  36. function setup() {
  37.   createCanvas(600, 400, WEBGL);
  38. }
  39.  
  40. function draw() {
  41.   background(random(0, 255), random(0, 255), random(0, 255));
  42.   //Box boi
  43.   rotateX(frameCount*0.02);
  44.   rotateY(frameCount*0.02);
  45.   fill(random(0, 255), random(0, 255), random(0, 255));
  46.   stroke(random(0, 255), random(0, 255), random(0, 255));
  47.   strokeWeight(4);
  48.   box(100, 100);
  49.   //Ball 1 functions
  50.   fill(random(0, 255), random(0, 255), random(0, 255));
  51.   Ball1.x += Ball1.xS;
  52.   if (Ball1.x >= width - 25 || Ball1.x <= 25) {
  53.     Ball1.xS *= -1;
  54.   }
  55.  
  56.   Ball1.y += Ball1.yS;
  57.   if (Ball1.y >= height - 25 || Ball1.y <= 25) {
  58.     Ball1.yS *= -1;
  59.   }
  60.   ellipse(Ball1.x, Ball1.y, 50, 50);
  61.   //Ball 2 functions
  62.   fill(random(0, 255), random(0, 255), random(0, 255));
  63.   Ball2.x += Ball2.xS;
  64.   if (Ball2.x >= width - 25 || Ball2.x <= 25) {
  65.     Ball2.xS *= -1;
  66.   }
  67.  
  68.   Ball2.y += Ball2.yS;
  69.   if (Ball2.y >= height - 25 || Ball2.y <= 25) {
  70.     Ball2.yS *= -1;
  71.   }
  72.   ellipse(Ball2.x, Ball2.y, 50, 50);
  73.   //Ball 3 functions
  74.   fill(random(0, 255), random(0, 255), random(0, 255));
  75.   Ball3.x += Ball3.xS;
  76.   if (Ball3.x >= width - 25 || Ball3.x <= 25) {
  77.     Ball3.xS *= -1;
  78.   }
  79.  
  80.   Ball3.y += Ball3.yS;
  81.   if (Ball3.y >= height - 25 || Ball3.y <= 25) {
  82.     Ball3.yS *= -1;
  83.   }
  84.   ellipse(Ball3.x, Ball3.y, 50, 50);
  85.   //Ball 4 functions
  86.   fill(random(0, 255), random(0, 255), random(0, 255));
  87.   Ball4.x += Ball4.xS;
  88.   if (Ball4.x >= width - 25 || Ball4.x <= 25) {
  89.     Ball4.xS *= -1;
  90.   }
  91.  
  92.   Ball4.y += Ball4.yS;
  93.   if (Ball4.y >= height - 25 || Ball4.y <= 25) {
  94.     Ball4.yS *= -1;
  95.   }
  96.   ellipse(Ball4.x, Ball4.y, 50, 50);
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement