Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. PFont myFont;
  2. String myText = "F I C K L E";
  3.  
  4. int rad = 500; // Width of the shape
  5. float xpos, ypos; // Starting position of shape
  6.  
  7. float xspeed =50; // Speed of the shape
  8. float yspeed = -20; // Speed of the shape
  9.  
  10. int xdirection = 50; // Left or Right
  11. int ydirection = -50; // Top to Bottom
  12.  
  13.  
  14. void setup(){
  15. size(960,540);
  16. noStroke();
  17.  
  18. myFont = createFont("garamond", 60);
  19. textFont(myFont);
  20. textAlign(CENTER, CENTER);
  21.  
  22.  
  23. frameRate(2);
  24. ellipseMode(CENTER);
  25. fill(250,150,120,190);
  26. xpos = width/2;
  27. ypos = height/2;
  28.  
  29. myFont = createFont("garamond", 60);
  30. textFont(myFont);
  31. textAlign(CENTER, CENTER);
  32. }
  33.  
  34. void draw(){
  35. background(102);
  36. fill(random(250),random(255),random(250),255);
  37. rect(0,0,width,height);
  38. fill(0,255);
  39. text(myText, width/2, height/2);
  40.  
  41. for (int y = 0; y < 100; y++){
  42. for (int i = 0; i < 500; i++){
  43. ellipse(i*8,y*8,5,5);
  44. fill(100,100,100,100);
  45. }
  46. }
  47.  
  48. xpos = xpos + ( xspeed * xdirection );
  49. ypos = ypos + ( yspeed * ydirection );
  50.  
  51. if (xpos > width-rad || xpos < rad) {
  52. xdirection *= -1;
  53. }
  54. if (ypos > height-rad || ypos < rad) {
  55. ydirection *= -1;
  56. }
  57.  
  58. // Draw the shape
  59. ellipse(xpos, ypos, rad, rad);
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement