Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set up
- color purple = color(204, 0, 204);
- color green = color(204, 255, 153);
- int variableName;
- int fadeValue = 0;
- int fadeChange = 1;
- color flashingBg;
- void setup () {
- size(700, 200);
- surface.setResizable(true);
- colorMode(HSB); // Changed to get the rainbow to work nicely
- noStroke();
- }
- void draw () {
- println("CassPayne_s5138931");
- // Update background colour based on screen width and height every frame - just a fun little bonus :)
- flashingBg = color(width % 255, 255, height % 255);
- background(flashingBg);
- // Create a 'C'
- LetterC(width/10, height/2);
- // Create a 'A' at 130, 50
- LetterA(130, 50);
- // Create a 'S' at 245, 50
- LetterS(245, 50);
- // Create a 'S' at 370, 50
- LetterS2(370, 50);
- // Create a 'P' at 520, 30
- LetterP(520, 30);
- //Create a '.' at
- FullStop(620, 140);
- }
- // Function to draw a 'C'
- void LetterC (int xPos, int yPos) {
- float radius = width * 0.08;
- float angle = PI/2.5;
- float curve = PI*1.6;
- // To create the rainbow letter effect
- variableName++;
- if (variableName > 255) {
- variableName = 0;
- }
- // Draw the main part of the C
- fill(color(variableName, 255, 255));
- arc(xPos, yPos, radius*2, radius*2, angle, curve, OPEN);
- // Fill with a slightly smaller arc to have the C space
- fill(flashingBg);
- arc(xPos+radius/2-20, yPos, radius*2-20, radius*2-20, angle, curve, OPEN);
- }
- // Function to draw a 'A'
- void LetterA (int xPos, int yPos) {
- int W = 80;
- int H = 100;
- // Draw the main part of A
- fill(color(variableName, 255, 255));
- rect(xPos, yPos, W, H);
- // Fill with smaller rect to create bottom A gap
- fill(flashingBg);
- rect(150, 100, 40, 80);
- // Small window inside of A
- rect(150, 65, 40, 20);
- }
- // Function to draw a 'S'
- void LetterS (int xPos, int yPos) {
- //Draw the main part of S
- int W = 90;
- int H = 100;
- fill(color(variableName, 255, 255));
- rect(xPos, yPos, W, H);
- //Fill with smaller rect to create S curves
- fill(flashingBg);
- rect(270, 70, 80, 20);
- rect(230, 110, 80, 20);
- }
- // Function to draw a 'S'
- void LetterS2 (int xPos, int yPos) {
- //Draw the main part of S
- int W = 90;
- int H = 100;
- fill(color(variableName, 255, 255));
- rect(xPos, yPos, W, H);
- //Fill with smaller rect to create S curves
- fill(flashingBg);
- rect(395, 70, 80, 20);
- rect(355, 110, 80, 20);
- }
- // Function to draw a 'P'
- void LetterP (int xPos, int yPos) {
- //Draw the main part of P
- int W = 30;
- int H = 120;
- fill(color(variableName, 255, 255));
- rect (xPos, yPos, W, H);
- square(530, 30, 80);
- //Fill with smaller rect to create P gap
- fill(flashingBg);
- square(550, 50, 40);
- }
- void FullStop (int xPos, int yPos) {
- int extent = 20;
- //Function to draw a full stop '.'
- fill(color(variableName, 255, 255));
- circle (xPos, yPos, extent);
- }
Advertisement
Add Comment
Please, Sign In to add comment