• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Spot the geek

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Spot the geek

    I randomly discovered this webpage:
    https://www.khanacademy.org/cs/progr...wesome-program

    and then spent some time altering the code to this:
    var myColourR = 0;
    var myColourG = 0;
    var myColourB = 0;

    fill(255, 0, 0);
    ellipse(5, 5, 10, 10);

    fill(0, 255, 0);
    ellipse(15, 5, 10, 10);

    fill(0, 0, 255);
    ellipse(25, 5, 10, 10);

    fill(0, 0, 0);
    ellipse(35, 5, 10, 10);

    fill(255, 255, 255);
    ellipse(45, 5, 10, 10);

    noStroke();

    var draw = function() {
    if (mouseIsPressed) {
    if (mouseX<=10 && mouseY <=10)
    {
    myColourR = 255;
    myColourG = 0;
    myColourB = 0;
    }
    if (mouseX>10 && mouseX<=20 && mouseY <=10)
    {
    myColourR = 0;
    myColourG = 255;
    myColourB = 0;
    }
    if (mouseX>20 && mouseX<=30 && mouseY <=10)
    {
    myColourR = 0;
    myColourG = 0;
    myColourB = 255;
    }
    if (mouseX>30 && mouseX<=40 && mouseY <=10)
    {
    myColourR = 0;
    myColourG = 0;
    myColourB = 0;
    }
    if (mouseX>40 && mouseX<=50 && mouseY <=10)
    {
    myColourR = 255;
    myColourG = 255;
    myColourB = 255;
    }
    if (mouseY>50)
    {
    fill(myColourR, myColourG, myColourB);
    ellipse(mouseX, mouseY, 22, 25);
    }

    }

    };
    for 10 minutes work I think I did quite well
    Coffee's for closers

Working...
X