We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › problem with void and stroke
Page Index Toggle Pages: 1
problem with void and stroke (Read 324 times)
problem with void and stroke
Apr 24th, 2008, 2:44pm
 
hi people
i'm new to this program and i'm doing this "clock" for one of my practice lessons

my current code is this:

void setup()
{
 size(640,480);
 noStroke();
 stroke(223,2,205);
}

//draw the second hand
void Second()
{
 int seconds = second();
 
 stroke(0,0,0,0);
 translate(320,240);
 rotate(radians(6*seconds));
 line(0,0,0,-170);
}

//draw the minute hand
void Minute()
{
 int minutes = minute();
 
 stroke(0,0,0);
 translate(320,240);
 rotate(radians(6*minutes));
 strokeWeight(3);
 line(0,0,0,-150);
}

//draw the hour hand
void Hour()
{
 int hours = hour();
 
 stroke(0,0,0);
 translate(320,240);
 rotate(radians(6*hours));
 strokeWeight(5);
 line(0,0,0,-100);
}

void draw()
{
 ellipse(320,240,400,400);
 
 Second();
 Minute();
 Hour();
}

when i run it, it shows me a syntax error: [expecting SEMI, found 'stroke'] and the stroke(0,0,0); is highlighted. the same thing happens for the other functions

i was wondering if SHAPE functions like stroke and lines are only restricted to be only usable in the void draw().

TIA for helping me out

*edit* my bad i've got it solved
Re: problem with void and stroke
Reply #1 - Apr 24th, 2008, 3:10pm
 
Glad you've got it sorted. I can see another issue though, you need some pushMatrix(); and popMatrix(); calls wrapping your seconds/minutes/hours functions.
Page Index Toggle Pages: 1