Hey all, give this a try, it's a 3D Clock with some face border effects.
Plop [http://www.fridaynightsoftware.com/public/time.dll]this DLL[/url] into your "Dark Basic Software\Dark Basic Professional\Compiler\plugins-user" folder in order to get the code below working.
The DLL currently contains 7 DBPro-extending time related functions:
print "Year: " + str$(get year())
print "Month: " + str$(get month())
print "Day: " + str$(get day())
print "---"
print "Hours: " + str$(get hours())
print "Minutes: " + str$(get minutes())
print "Seconds: " + str$(get seconds())
print "---"
print "Day of Week: " + str$(get weekday())
wait key
` ------------------------------------------------------------
` DBPro 3D Clock author: ChipOne (James Chambers)
` date: Oct. 13, 2002
` ------------------------------------------------------------
` This is a simple clock thrown together to make use of the
` time DLL I have written for DBPro. Feel free to use and
` modify the code as you like.
` ------------------------------------------------------------
` basic set up
sync on:sync rate 0:autocam off:color backdrop 0:set ambient light 10
` create some objects to spin around the clock
for i = 1000 to 1359 step 15:make object cylinder i, 2:color object i, rgb(0,0,92):rotate object i, 0, 0, 90
scale object i, 10, 40, 10:fix object pivot i:ghost object on i:next i
` this is the centre dot in the middle of the clock
make object sphere 500, 1, 13, 3:position object 500, 0, 0, 9:color object 500, rgb(0,128,0)
` these are the hour indicators, like normally numbers
` or roman numerals, but I'm just using spheres
for i = 200 to 212:make object sphere i,1:position object i, sin((i-200)*30)*12, cos((i-200)*30)*12, 7:scale object i, 70, 70, 70:color object i, rgb(255,255,0):next i
` make the 12, 3, 6, 9 indicators bigger
for i = 200 to 212 step 3:scale object i, 120, 120, 120:next i
` build the hour, minute and second hands
for i = 1 to 3:make object cylinder i, 2:color object i, rgb(92,0,0):rotate object i, 0, 0, 90:fix object pivot i:next i
` size the clock hands as needed
scale object 1, 10, 70, 10:scale object 2, 20, 100, 20:scale object 3, 30, 50, 30
` get camera in check
position camera 0, 0, -15:point camera 0, 0, 0
do
` increment our base angle for doing the movement effects and resample the local system time
inc ang:hours = get hours():minutes = get minutes():seconds = get seconds()
` update the hands to be 'paralel' to the centre of the clock
rotate object 1, 0, 0, wrapvalue(360-wrapvalue(minutes * 6)):rotate object 2, 0, 0, wrapvalue(360-wrapvalue(seconds * 6)):rotate object 3, 0, 0, wrapvalue(360-wrapvalue(hours * 6))
` postion the hands according to their values
position object 1, sin(wrapvalue(minutes * 6)) * (sin(wrapvalue(ang*6))*3+3), cos(wrapvalue(minutes * 6)) * (sin(wrapvalue(ang*6))*3+3), 5:position object 2, sin(wrapvalue(seconds * 6)) * 10, cos(wrapvalue(seconds * 6)) * 10, 5:position object 3, sin(wrapvalue(hours * 30)) * (sin(wrapvalue(ang*2))*2+2), cos(wrapvalue(hours * 30)) * (sin(wrapvalue(ang*2))*2+2), 5
` eye candy. rotate those objects around the face of the clock
for i = 1000 to 1359 step 15:position object i, sin(wrapvalue(i-1000+ang/3))*12, cos(wrapvalue(i-1000+ang/3))*12, 6:rotate object i, 0, 0, wrapvalue(wrapvalue(i-1000+ang/3)):next i
` show me the money
sync
loop
only 16 actual lines of code (which could be less). now I wait on my slap on the wrist for writing a DLL to get the time.
-= i only do what my rice krispies tell me to do =-