Make a clock

Make a clock face consisting on a big white circle. Give it just one hand, the "seconds" hand. Make it a black line. Make it tick in the way a seconds hand ticks. Number the 12, 3, 6 and 9 points on your clock. Don't worry about the minutes and hours hands.



  • edited May 2015

    This forum is not for handing out code. Explain why you are stuck writing this yourself and post your efforts so far. Someone will help you from there

    You can get the number of milliseconds that have passed since the sketch started using millis(). Divide that by 1000 to get seconds (instead of milliseconds) and then plug that into rotate()

    You will have to map the value, every 60 seconds (or 60000 milliseconds) rotate will have to be back where it was. In other words, make it so that rotate accomplishes TWO_PI rotations (same as 360 degrees) every 60 seconds

  • There is a seconds() method that fits better than millis() IMO

  • edited May 2015

    No full code solutions please.

  • ban angel fire

  • Light the fires, burn the heretics! This is the result of over zealousness! >:)

  • edited May 2015


    really, he posted 4 times just the texts for assignments...

  • float r,t,c,x,y; void
    draw(){if(random(1)<.05)background(0);text("I AM BAD WITH COMPUTER!!!!1one",20,20);r();
    rotate(r); line(0,0,100,0);ellipse(0,0,map(mouseX,0,220,20,200),220-map(mouseY,0,220,20,200));}void
    setup(){size(220,220);stroke(255);strokeWeight(3);noFill();ellipseMode(CENTER);} void
    r(){t--;text("HELP HELP",110+random(-20,20),110+random(-20,20));if(t<0){t=random(200);c=random(TWO_PI);}
  • angelfire101 is posting homework questions and asking for code solutions (see here). That is called cheating. We are not here to support cheats.

    @angelfire101 if you continue to ask for code solutions for what is obviously a school assignment you risk being banned.

    If you want further help with this problem please post the code that you have produced in attempting to solve the problem.

    Will members please wait for angelfire101's code before posting any further help.

  • _vk_vk
    edited May 2015

    If I had to crack this one, I would want to know about circular functions, (sin() cos() - see reference/wikipedia) aka trigonometry.

    A clock is a circle… And it has 60 seconds, a circle has 360 degrees… seems easy math :)

    Note that sin() and cos() are expecting radians, theres a handy function by that name also.

  • yeah, there is a nice tutorial on trigonometry

    but reading that means real work...


Sign In or Register to comment.