Advertisement
otorp2

p5js atom

Jun 30th, 2020
1,689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <head>
  2. <script src = "p5.js"></script>
  3. <script src ="p5.dom.js"></script>
  4. </head>
  5. <body>
  6. <script>
  7. //https://www.kadenze.com/courses/the-nature-of-code-ii/sessions/introduction-overview
  8. var x = 4;
  9. var w;
  10. var m;
  11. var xpos;
  12. var ypos;
  13. function setup(){
  14.   createCanvas(400,400);
  15.   w = new Walker();
  16.   //m = new Move();
  17. }
  18.  
  19. function draw(){
  20.   background(255);
  21.   w.display(xpos,ypos);
  22.  
  23. }
  24.  
  25. function Walker(){
  26.   this.x = xpos;
  27.   this.y = height/2;
  28.   this.display = function(){
  29.     //fill(255);
  30.     noFill();
  31.     ellipse(this.x,this.y,45,45);
  32.   }
  33. }
  34.  
  35. </script>
  36.  
  37. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement