当前位置: 首页 > 图文教程 > 网络编程 > ASP > 调用DirectX的组件实现的时钟

ASP
ASP 三层架构 Convert类实现代码
asp 采集程序常用函数分析
asp 通用修改和增加函数代码
初学js者对javascript面向对象的认识分析
Asp定时执行操作 Asp定时读取数据库(网页定时操作详解)
ASP 80040e14错误的解决方法
ASP实例:ASP+AJAX制作无刷新新闻评论系统
ASP教程:ContentType属性
rs.open sql,conn,1,1全接触
处理较长文章,添加 …… 效果
[ASP]利用 xmlhttp 分块上传文件
asp,php 和 jsp 比较 之我见
刷一次变一次图的ASP代码
ASP基础
随机生成文件名的函数
ASP自动解压RAR文件
从数据表中取出第n条到第m条的记录的方法
WEB打印大全
在ASP与ASP.NET之间共享对话状态(2)
在ASP与ASP.NET之间共享对话状态(1)

ASP 中的 调用DirectX的组件实现的时钟


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 249 ::
收藏到网摘: n/a

  下面的代码是调用的DirectX的组件实现的时钟。它有三根指针,会实时地随系统时间的改变而改变。
不过我没有做刻度,因为我觉得用程序画出来的刻度不漂亮,用PHOTOSHOP画一口钟作为背景要漂亮多了。


<html>
<head>
<title>指针式时钟</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div id="LayClock" style="position:absolute; width:101; height:101px; z-index:2; left: 203px; top: 101px">
  <object id="DAControl" width=101 height=101 align=LEFT hspace=0
   classid="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D">
  </object>
  <SCRIPT LANGUAGE="VBScript">
<!--
  Set m = DAControl.PixelLibrary
  pi = 3.14159265359
  Sub window_onLoad
    a = time
    min1 = minute(time)
    hr1 = hour(time)
    sec1 = second(time)
    Set xPos = m.Mul(m.DANumber(150), m.Cos(m.Mul(m.LocalTime,m.DANumber(0.3))))
    Set yPos = m.Mul(m.DANumber(35), m.Cos(m.Mul(m.LocalTime,m.DANumber(0.5))))
    Set clock = m.Overlay(hands(hr1,min1,sec1),hands(hr1,min1,sec1))
    DAControl.Image = clock
    DAControl.Start
  End Sub
  Function hands(hr,min,sec)
    Set bvr60 = m.DANumber(60)
    Set secFromMidnight = m.Add(m.DANumber(hr*3600+min*60+sec),m.LocalTime)
    Set secBvr = m.Mod(secFromMidnight,bvr60)
    Set minBvr = m.Mod(m.Div(secFromMidnight,bvr60),bvr60)
    Set hrBvr = m.Mod(m.Div(secFromMidnight,m.DANumber(3600)),m.DANumber(12))
    ptsSec = Array( -10, -2, 42, -1, 42, 1, -10,2 )
    ptsMin = Array(-7, -2, 36, -1, 36, 1, -7, 2 )
    ptsHr = Array(-5, -3, 32, -1, 32, 1, -5, 3 )
    Set temp1 = m.Mul(m.DANumber(-pi/30),m.Sub(secBvr,m.DANumber(15)))
    Set temp2 = m.Mul(m.DANumber(-pi/30),m.Sub(minBvr,m.DANumber(15)))
    Set temp3 = m.Mul(m.DANumber(-pi/6),m.Sub(hrBvr,m.DANumber(3)))
    Set imgSec = m.PolyLine(ptsSec).Fill(m.DefaultLineStyle,m.SolidColorImage(m.cyan))
    Set imgSec = imgSec.TransForm(m.Rotate2Anim(temp1))
    Set imgMin = m.PolyLine(ptsMin).Fill(m.DefaultLineStyle,m.SolidColorImage(m.yellow))
    Set imgMin = imgMin.TransForm(m.Rotate2Anim(temp2))
    Set imgHr = m.PolyLine(ptsHr).Fill(m.DefaultLineStyle,m.SolidColorImage(m.green))
    Set imgHr = imgHr.TransForm(m.Rotate2Anim(temp3))
    Set hands = m.Overlay(imgSec,m.Overlay(imgMin,imgHr))
  End Function
-->
</SCRIPT></div>
</body>
</html>