drusssy

Untitled

Jul 29th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. // Set up
  2. color purple = color(204, 0, 204);
  3. color green = color(204, 255, 153);
  4. int variableName;
  5. int fadeValue = 0;
  6. int fadeChange = 1;
  7.  
  8. color flashingBg;
  9.  
  10. void setup () {
  11. size(700, 200);
  12. surface.setResizable(true);
  13. colorMode(HSB); // Changed to get the rainbow to work nicely
  14. noStroke();
  15. }
  16.  
  17. void draw () {
  18. println("CassPayne_s5138931");
  19.  
  20. // Update background colour based on screen width and height every frame - just a fun little bonus :)
  21. flashingBg = color(width % 255, 255, height % 255);
  22. background(flashingBg);
  23.  
  24. // Create a 'C'
  25. LetterC(width/10, height/2);
  26.  
  27. // Create a 'A' at 130, 50
  28. LetterA(130, 50);
  29.  
  30. // Create a 'S' at 245, 50
  31. LetterS(245, 50);
  32.  
  33. // Create a 'S' at 370, 50
  34. LetterS2(370, 50);
  35.  
  36. // Create a 'P' at 520, 30
  37. LetterP(520, 30);
  38.  
  39. //Create a '.' at
  40. FullStop(620, 140);
  41. }
  42.  
  43. // Function to draw a 'C'
  44. void LetterC (int xPos, int yPos) {
  45. float radius = width * 0.08;
  46. float angle = PI/2.5;
  47. float curve = PI*1.6;
  48.  
  49. // To create the rainbow letter effect
  50. variableName++;
  51. if (variableName > 255) {
  52. variableName = 0;
  53. }
  54.  
  55. // Draw the main part of the C
  56. fill(color(variableName, 255, 255));
  57.  
  58. arc(xPos, yPos, radius*2, radius*2, angle, curve, OPEN);
  59.  
  60. // Fill with a slightly smaller arc to have the C space
  61. fill(flashingBg);
  62.  
  63. arc(xPos+radius/2-20, yPos, radius*2-20, radius*2-20, angle, curve, OPEN);
  64.  
  65. }
  66.  
  67. // Function to draw a 'A'
  68. void LetterA (int xPos, int yPos) {
  69. int W = 80;
  70. int H = 100;
  71.  
  72. // Draw the main part of A
  73. fill(color(variableName, 255, 255));
  74.  
  75. rect(xPos, yPos, W, H);
  76.  
  77. // Fill with smaller rect to create bottom A gap
  78. fill(flashingBg);
  79.  
  80. rect(150, 100, 40, 80);
  81.  
  82. // Small window inside of A
  83. rect(150, 65, 40, 20);
  84.  
  85. }
  86.  
  87. // Function to draw a 'S'
  88. void LetterS (int xPos, int yPos) {
  89.  
  90. //Draw the main part of S
  91. int W = 90;
  92. int H = 100;
  93.  
  94. fill(color(variableName, 255, 255));
  95.  
  96. rect(xPos, yPos, W, H);
  97.  
  98. //Fill with smaller rect to create S curves
  99. fill(flashingBg);
  100.  
  101. rect(270, 70, 80, 20);
  102. rect(230, 110, 80, 20);
  103.  
  104. }
  105.  
  106. // Function to draw a 'S'
  107. void LetterS2 (int xPos, int yPos) {
  108.  
  109. //Draw the main part of S
  110. int W = 90;
  111. int H = 100;
  112.  
  113. fill(color(variableName, 255, 255));
  114.  
  115. rect(xPos, yPos, W, H);
  116.  
  117. //Fill with smaller rect to create S curves
  118. fill(flashingBg);
  119.  
  120. rect(395, 70, 80, 20);
  121. rect(355, 110, 80, 20);
  122.  
  123. }
  124.  
  125. // Function to draw a 'P'
  126. void LetterP (int xPos, int yPos) {
  127.  
  128. //Draw the main part of P
  129. int W = 30;
  130. int H = 120;
  131.  
  132. fill(color(variableName, 255, 255));
  133.  
  134. rect (xPos, yPos, W, H);
  135. square(530, 30, 80);
  136.  
  137. //Fill with smaller rect to create P gap
  138. fill(flashingBg);
  139.  
  140. square(550, 50, 40);
  141. }
  142.  
  143. void FullStop (int xPos, int yPos) {
  144. int extent = 20;
  145. //Function to draw a full stop '.'
  146. fill(color(variableName, 255, 255));
  147.  
  148. circle (xPos, yPos, extent);
  149. }
Advertisement
Add Comment
Please, Sign In to add comment