Tells the right time too!
Yes, it's been a slow week ;-) Anyway, I honestly didn't set out to do this, just make a normal clock. I thought I'd add some nice FX with the DXImageTransform (like a light,shadow or a glow). I eventually added the wave and thought "Hey,that looks familiar!"
Notes:-
I set the CoordSize at 64x64 pixels, but I define the hands only half this height....this way the rotation pivot will be at the base of each hand, so I just rotate it and no messing around.
To make the lines around the clock face, I would need 24 coords (and even more messing around)...Instead I draw 4 lines that go right across the clock face, then draw a smaller white circle in the middle ;-)
Have fun!
*EDIT Save it as whatever.HTA, and double click it to run.
<HTML><HEAD><TITLE>Dali Clock - By Alan Bond</TITLE>
<HTA:APPLICATION CONTEXTMENU="no" MAXIMIZEBUTTON = "No" MINIMIZEBUTTON = "No" BORDER="Thin" />
<STYLE type="text/css"><!--
v\: * { behavior:url(#default#VML); display:inline-block } --></STYLE>
<XML:NAMESPACE NS="urn:schemas-microsoft-com:vml" PREFIX="v" /></HEAD>
<BODY SCROLL="no" STYLE="margin:0px"><DIV ID="htmBuild"></DIV></BODY>
<SCRIPT LANGUAGE="VBScript">
Option Explicit : Randomize Timer
Dim vmlShape(6),IntervalSecond,L,S
'---- VML shape data'
Dim Paths : Paths = Array("M32,0 C73,2 73,62 32,64 M32,0 C-9,2 -9,62 32,64", _
"M32,0 L32,64 M1,32 L63,32 M16,5 L48,59 M48,5 L16,59 M5,16 L59,47 M5,48 L59,16", _
"M32,8 C63,10 63,56 32,56 M32,8 C1,8 1,56 32,56", "M32,4 L31,20 32,32 33,20 X", _
"M32,16 L31,20 32,32 33,20 X","66,90 32,65 76,65 78,32 66,79 78,68","M32,3 L32,32")
'---- Build VML shapes'
For L=0 to 6 : S=S & "<V:SHAPE ID='vmls" & L & "'></V:SHAPE>" : Next
htmBuild.InnerHTML=S
For L=0 to 6
Set vmlShape(L)=Document.GetElementByID("vmls" & L)
With vmlShape(L)
.Style.Position="Absolute" : .Style.Width="100%" : .Style.Height="100%"
.StrokeWeight=2 : .StrokeColor=Int(Rnd(1)*&H606060)
.CoordSize="64 64" : .Path=Paths(L) : .FillColor = Int(Rnd(1)*&HFFFFFF)
If L=0 or L=2 then .FillColor="white" : If L Then .StrokeColor="white"
End With
Next
Document.Body.BGColor = Int(Rnd(1)*&HFFFFFF)
'---- Wave FX....Remove this for a normal looking clock'
With htmBuild
.Style.Position="Absolute":.Style.Width="100%":.Style.Height="100%":.Style.left=-15
.Style.Filter="ProgID:DXImageTransform.Microsoft.Wave" : .Filters(0).Freq=2 :
.Filters(0).Strength=15 : .Filters(0).LightStrength=20 : .Filters(0).Phase=Int(Rnd(1)*100)
End With
'---- ^ Remove'
'---- Refresh hands right away and start interval'
MoveHands() : Self.ResizeTo 350,370 : Self.MoveTo (Screen.Width/2)-175,(Screen.Height/2)-185
IntervalSecond = Window.SetInterval ("MoveHands", 1000) '<-- Update every second (no point being shorter)'
'---- Set rotation to time (360/60=6, the hour is a bit tricky though)'
Sub MoveHands()
vmlShape(6).Rotation=Second(Now)*6
vmlShape(3).Rotation=Minute(Now)*6 '<-- Fine rotation not needed on minutes'
vmlShape(4).Rotation=Hour(Now)*30 + (Minute(Now)/2.5) '<-- Needed for hours though'
End Sub
</SCRIPT></HTML>
<message edited by AMBience on Friday, December 03, 2010 12:10 PM>