纯js代码制作的网页时钟特效【附实例】
纯js代码制作的网页时钟特效,需要的码农可以拿去看一下。给大家做个参考。
<HTML><HEAD>
<METAhttp-equiv=Content-Typecontent="text/html;charset=gb2312">
<METAcontent="MSHTML6.00.6000.16414"name=GENERATOR></HEAD>
<BODY>
<DIV
style="LEFT:155px;WIDTH:400px;ZOOM:1;POSITION:absolute;TOP:133px;HEIGHT:300px">
<DIVid=bg
style="LEFT:-22px;WIDTH:150px;ZOOM:1.5;POSITION:absolute;TOP:-57px;HEIGHT:150px"><IMG
style="Z-INDEX:22;WIDTH:129px;HEIGHT:129px"src="https://img.jbzj.com/upload/novelty.gif">
</DIV>
<DIVid=h
style="PADDING-RIGHT:5px;PADDING-LEFT:5px;PADDING-BOTTOM:5px;WIDTH:129px;PADDING-TOP:5px;POSITION:absolute;HEIGHT:129px"><IMG
style="Z-INDEX:22;WIDTH:129px;HEIGHT:129px"src="https://img.jbzj.com/upload/novelty_h.gif">
</DIV>
<DIVid=m
style="PADDING-RIGHT:5px;PADDING-LEFT:5px;PADDING-BOTTOM:5px;WIDTH:129px;PADDING-TOP:5px;POSITION:absolute;HEIGHT:129px"><IMG
style="Z-INDEX:22;WIDTH:129px;HEIGHT:129px"src="https://img.jbzj.com/upload/novelty_m.gif">
</DIV>
<DIVid=s
style="PADDING-RIGHT:5px;PADDING-LEFT:5px;PADDING-BOTTOM:5px;WIDTH:129px;PADDING-TOP:5px;POSITION:absolute;HEIGHT:129px"><IMG
style="Z-INDEX:22;WIDTH:129px;HEIGHT:129px"src="https://img.jbzj.com/upload/novelty_s.gif">
</DIV>
<DIVid=dot
style="PADDING-RIGHT:5px;PADDING-LEFT:5px;PADDING-BOTTOM:5px;WIDTH:129px;PADDING-TOP:5px;POSITION:absolute;HEIGHT:129px"><IMG
style="Z-INDEX:22;WIDTH:129px;HEIGHT:129px"src="https://img.jbzj.com/upload/novelty_dot.gif">
</DIV>
<DIV>
<SCRIPT>
//oObjinputrequiresthatamatrixfilterbeapplied.
//deginputdefinestherequestedangleofrotation.
vardeg2radians=Math.PI*2/360;
functionMatrixFilter(obj)
{
if(!obj.filters)return;
//alert(obj.filters.item(0));
varMatrix;
for(pinobj.filters)
{
if(p=="DXImageTransform.Microsoft.Matrix")Matrix=obj.filters["DXImageTransform.Microsoft.Matrix"];
}
if(!Matrix)
{
obj.style.filter+="progid:DXImageTransform.Microsoft.Matrix()";
}
Matrix=obj.filters["DXImageTransform.Microsoft.Matrix"];
this.equal=function(Matrix2D_x)
{
if(Matrix2D_x.M11)Matrix.M11=Matrix2D_x.M11;
if(Matrix2D_x.M12)Matrix.M12=Matrix2D_x.M12;
if(Matrix2D_x.M21)Matrix.M21=Matrix2D_x.M21;
if(Matrix2D_x.M22)Matrix.M22=Matrix2D_x.M22;
}
if(arguments[1])this.equal(arguments[1]);
this.Rotate=function(deg)
{
rad=deg*deg2radians;
costheta=Math.cos(rad);
sintheta=Math.sin(rad);
vard=newMatrix2D(costheta,-sintheta,sintheta,costheta);
this.equal(Matrix2D.Mul(Matrix,d));
}
this.RotateTo=function(deg)
{
rad=deg*deg2radians;
costheta=Math.cos(rad);
sintheta=Math.sin(rad);
vard=newMatrix2D(costheta,-sintheta,sintheta,costheta);
this.equal(d);
}
this.RotateAt=function(deg,sx,sy)
{
rad=deg*deg2radians;
costheta=Math.cos(rad);
sintheta=Math.sin(rad);
vard=newMatrix2D(costheta,-sintheta,sintheta,costheta);
varx=sx-Matrix.Dx;
vary=sy-Matrix.Dy;
this.MoveTo(x*costheta+y*sintheta-x,-x*sintheta+y*costheta-y);
this.equal(Matrix2D.Mul(Matrix,d));
}
this.RotateToAt=function(deg,sx,sy)
{
rad=deg*deg2radians;
costheta=Math.cos(rad);
sintheta=Math.sin(rad);
vard=newMatrix2D(costheta,-sintheta,sintheta,costheta);
varx=sx;
vary=sy;
this.MoveTo(x-(x*costheta-y*sintheta),-(x*sintheta+y*costheta-x));
this.equal(d);
}
this.MoveTo=function(sx,sy)
{
Matrix.Dx=sx;
Matrix.Dy=sy;
}
this.toMatrix2D=function()
{
returnnewMatrix2D(Matrix.M11,Matrix.M12,Matrix.M21,Matrix.M22);
}
this.ZoomBy=function(sx,sy)
{
vard=newMatrix2D(sx,0,0,sy);
this.equal(Matrix2D.Mul(Matrix,d));
}
this.toString=function()
{
return""+Matrix.M11+""+Matrix.M12+"\n"+Matrix.M21+""+Matrix.M22+"\n"
}
//Matrix.SizingMethod='cliptooriginal';
//this.fnSetRotation(30);
//alert(Matrix.M11);
//alert(obj.filters["DXImageTransform.Microsoft.Matrix"]);
}
functionMatrix2D()
{
this.M11=arguments[0]||1;
this.M12=arguments[1]||0;
this.M21=arguments[2]||0;
this.M22=arguments[3]||1;
this.Mul_Matrix2D=function(Matrix2D_b)
{
varr=newMatrix2D();
r=Matrix2D.Mul(this,Matrix2D_b);
returnr;
}
this.toString=function()
{
return""+this.M11+""+this.M12+"\n"+this.M21+""+this.M22+"\n"
}
}
Matrix2D.Mul=function(Matrix2D_a,Matrix2D_b)
{
varr=newMatrix2D();
r.M11=Matrix2D_a.M11*Matrix2D_b.M11+Matrix2D_a.M12*Matrix2D_b.M21;
r.M12=Matrix2D_a.M11*Matrix2D_b.M12+Matrix2D_a.M12*Matrix2D_b.M22;
r.M21=Matrix2D_a.M21*Matrix2D_b.M11+Matrix2D_a.M22*Matrix2D_b.M21;
r.M22=Matrix2D_a.M21*Matrix2D_b.M12+Matrix2D_a.M22*Matrix2D_b.M22;
returnr;
}
varms=newMatrixFilter(s);
varmm=newMatrixFilter(m);
varmh=newMatrixFilter(h);
vari=1;
setInterval("ms.RotateToAt((newDate()).getSeconds()*6+6,69,69)",500);
setInterval("mm.RotateToAt((newDate()).getMinutes()*6+6,69,69)",500);
setInterval("mh.RotateToAt(((newDate()).getHours()+(newDate()).getMinutes()/60)*30,69,69)",500);
//mf.MoveTo(30,70);
//mf.ZoomBy(1.5,1.5);
//mf.ZoomBy(1.5,1.5);
//alert(mf.toMatrix2D());
//alert(Matrix2D.Mul(m2d1,m2d2));
//fnSetRotation(oDiv.filters.item(0),30);
</SCRIPT>
</DIV></DIV></BODY></HTML>
以上这篇纯js代码制作的网页时钟特效【附实例】就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。
