Message: 12
Date: Tue, 31 May 2005 02:22:08 -0700
From: Scott Rossi <[EMAIL PROTECTED]>
Subject: Yet Another Clock
To: How to use Revolution <[email protected]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="US-ASCII"
At the risk of beating a dead clock, here is another more visual approach to
the display of time which uses the points of a hidden graphic to
determine the location of each "hand" (still pretty minimal/efficient code).
In your message box:
go url "http://www.tactilemedia.com/download/ballclock.rev"
This actually took a lot longer than three minutes to build in that I had to
figure out how to create a vector graphic that contained 60 equidistant
points (the solution was to create the source ring in a vector program and
then import into Rev using Alejandro Tejada's EPSimport stack). Of course
this could be done using math by the Jim Hurley types on the list but that
kind of thing eludes me...
See the card script for details.
Regards,
Scott Rossi
Creative Director
Tactile Media, Development & Design
-----
E: [EMAIL PROTECTED]
W: http://www.tactilemedia.com
Scott,
Enjoyed your Ball Clock. I need to sit down and figure out where
those minute and hour settings come from.
The sixty points on the circle can be derived from the following
handlers which convert 60 radial coordinates into 60 rectangular
coordinates.
on mouseUP
put 100 into R
repeat with a = 1 to 360 step 6
put XYcorGivenRAcor(R,a) & cr after results
end repeat
set the points of grc "myPoly" to results
end mouseUP
function XYcorGivenRAcor r,a
put the width of this stack/2 into x0
put the height of this stack/2 into y0
put r*cos(a*pi/180) into x
put r*sin(a*pi/180) into y
return round(x0-x),round(y0-y)
end XYcorGivenRAcor
Couldn't resist a Turtle Graphics (actually the Tell Turtles version
thereof) formulation of the clock problem. It uses your same three
objects to represent the seconds, minutes and hours. The setRA
function is similar to the XYcorGivenRAcor function above.
on setTime
set the itemdelimiter to ":"
put word 1 of the long time into T
tell "seconds"; setRA r,90-6*item 3 of T
tell "minutes"; setRA r,90 - (6 * item 2 of T) - (item 3 of T) / 10
tell "hours"; setRA r, 90 - (30 * item 1 of T) - (item 2 of T) / 2
send "setTime" to me in 1 sec
end setTime
Jim
_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution