--- In [email protected], "Thomas Steiner"
<[EMAIL PROTECTED]> wrote:
>
> Hi Michel,
>
> > * add additive="sum" to your animated elements
> > * set time for svg to current date as
> >
> > var time = new Date()
> > var time_seconds = time.getHours()*3600 + time.getMinutes()*60 +
> > time.getSeconds()
> > evt.target.ownerDocument.rootElement.setCurrentTime(time_seconds)
> >
> > With this solution you can have problems if you have other
> > animations in your svg
>
> Thanks a lot for your answer, but what happens then? My hour hand and
> second hand needs to know it's initial angle. How? Here you told just
> the document's root elements the current time. What did I miss here?
> This (3 hands) is my only animation in the SVG.
> Thomas
>
You then set the rotation angle based on the time. This is how I
display a clock with a minute hand and two hour hands (same idea as
Michel's). The two hour hands are local and UTC:
var curdate = new Date();
var Minutes = curdate.getMinutes();
var Hours = curdate.getHours() + Minutes / 60;
var Offset = curdate.getTimezoneOffset() / 60 + Hours;
LegDoc = document.embeds[1].getSVGDocument();
LegDoc.getElementById("minutes_local").setAttribute('transform',
'rotate(' + (Minutes * 6) + ')');
LegDoc.getElementById("hours_local").setAttribute('transform',
'rotate(' + (Hours * 30) + ')');
LegDoc.getElementById("hours_UTC").setAttribute('transform',
'rotate(' + (Offset * 30) + ')');
The clock is in an embedded svg document and the SVG code for the
clock is:
<g transform="translate(100 100)">
<g id="hours_UTC">
<line x1="0" y1="0" x2="0" y2="-35" style="stroke-width:4"
stroke="red">
</line>
</g>
<g id="hours_local">
<line x1="0" y1="0" x2="0" y2="-35" style="stroke-width:4"
stroke="black">
</line>
</g>
<g id="minutes_local">
<line x1="0" y1="0" x2="0" y2="-55" style="stroke-width:2"
stroke="black">
</line>
</g>
</g>
<circle cx="100" cy="100" r="3" fill="black" stroke="black"/>
</g>
You will need to add a second hand similar to above.
Hope this helps.
Bruce Rindahl
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/