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

ASP
提高SQL的执行效率的ASP的五种做法
asp的offset的一个go to page
asp中command的在单条记录时,有些字段显示为空的问题
asp,php一句话木马整理方便查找木马
asp 合并记录集并删除的sql语句
asp下循环一行多少个
asp循环行数输出函数
asp access重新开始编号
ASP生成数字相加求和的BMP图片验证码
静态页面利用JS读取cookies记住用户信息
比较详细的Asp伪静态化方法及Asp静态化探讨
asp Response.flush 实时显示进度
Asp高级故障解决以及相关代码
asp智能脏话过滤系统v1.0
ASP文件中的安全问题
Access数据库中“所有记录中均未找到搜索关键字”的解决方法
asp两组字符串数据比较合并相同数据
asp MYSQL出现问号乱码的解决方法
asp文章中随机插入网站版权文字的实现代码
ASP利用XMLHTTP实现表单提交以及cookies的发送的代码

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 179 ::
收藏到网摘: 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>