3D玫瑰

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>js</title>

//javascript→liuxingyu
<script>
var count=10
var X=new Array(count)
var Y=new Array(count)
var W=new Array(count)
var H=new Array(count)
var Vx=new Array(count)
var Vy=new Array(count)
var t=new Array(count)

var timeOut=50
var g=0.98

function Shooting()
{
    for(i=0; i<count; i++)
    {
        x=X[i]-Vx[i]*t[i]
        y=Y[i]+Vy[i]*t[i]+g*t[i]*t[i]/2
        H[i]=(Vy[i]+g*t[i])/Vx[i]*W[i]
        t[i]++

        cmd="shooting"+i+".style.posLeft="+x+";\n"
        cmd+="shooting"+i+".style.posTop="+y+";\n"
        cmd+="shooting"+i+".style.height="+H[i]+";"
        eval(cmd)

        if(x<0||y>document.body.clientHeight)
        {
            X[i]=Math.random()*document.body.clientWidth
            Y[i]=Math.random()*document.body.clientHeight/2
            W[i]=Math.random()*10+10
            Vx[i]=Math.random()*8+2
            Vy[i]=Math.random()*8+2
            H[i]=Vy[i]/Vx[i]*W[i]
            t[i]=0
        }
    }

    setTimeout("Shooting()", timeOut)
}

function initShooting(src)
{
    for(i=0; i<count; i++)
    {
        X[i]=Math.random()*document.body.clientWidth
        Y[i]=Math.random()*document.body.clientHeight/2
        W[i]=Math.random()*10+10
        Vx[i]=Math.random()*8+2
        Vy[i]=Math.random()*8+2
        H[i]=Vy[i]/Vx[i]*W[i]
        t[i]=0
        document.write("<img align=bottom border=0 id='shooting"+i+"' src='"+src+"' style='LEFT: "+X[i]+"px; TOP: "+Y[i]+"; WIDTH: "+W[i]+"; HEIGHT: "+H[i]+"; POSITION: absolute;'>")
    }

    setTimeout("Shooting()", timeOut)
}
</script>
</head>
<body  style="background: url('2.jpg') no-repeat ">
<script>initShooting("1.gif")</script>
<div style="position: absolute; top: 10px; left: 500px;" align="center">
<canvas></canvas>
</div>
<div style="width: 300px; height: 300px;position: absolute; top: 300px; left: 500px;" align="center">
	Regardless of whether or not keep relationship with you, 
	<br/>I would want to let you know. You are my only obsession
	<br/>do it by  javascript  <br/> thanks for your love
</div>
//javascript→rose
<script>
var c = document.getElementsByTagName('canvas')[0];
var b = document.body;
var a = c.getContext('2d');
with(m=Math)C=cos,S=sin,P=pow;
O=a.getImageData(0,0,c.height=f=W=256,f);
U=O.data;
D={};
F=[];
function J(p){p[5]=Q=0;
for(j=3;j--;
)
if(!D[Q=(p[j]>>=2)+Q*f])
D[Q]=F.push(p)}setInterval(function(){for(i=1e3;i--;){c=i%42*1.35;H=T;T=m.random();A=H*2-1;B=T*2-1;J([S(H*7)*(o=13+5/(.2+P(T*4,4)))-T*50,T*550+500,(l=C(H*7))*o,(G=l/7+.5)-T/4,G]);if(A*A+B*B<1)if(c>32){J([(o=.5/(H+.01)-H*300)*C(n=(j=c&1)?6:4)+(w=T*-f)*S(n)+j*630-390,o*S(n)-w*C(n)+999-j*350,C(B+A)*99-j*50,(P(l=1-B*B,f*6)+C(H+T)+P(C((o*H+o+(B>0?w:-w))/25),30)*l-H+2)/5,o/1e3+.7-o*w/3e5]);J([(o=H*45-20)*C(l=c/.86)+(w=T*T)*f*S(l),C(B/2)*99-w*T*60+436,o*S(l)-w*f*C(l),w*.3+.3,T*.7])}else J([(o=A*(2-T)*(80-c*2))*C(c)-(w=99-C(A)*120-C(T)*(f-c*5)+C(P(1-T,7))*50+c*2)*S(c),(B*2-C(P(T,7))+9)*50,o*S(c)+w*C(c),1-T*.7,P(1-T,9)/4])}for(i=0;i<f*f;m[i++]=f)for(l=4;l--;)U[i*4+l]=255;for(c=C(W),s=S(W),j=F.length;j--;){k=F[j],x=k[0]*c+k[2]*s+99,z=k[0]*s-k[2]*c,y=k[1]-z*.4<<8;for(i=3;i--;)if(z<m[p=y-~x+[0,1,f][i]])for(m[p]=z,l=3;l--;)U[p*4+l]=k[l+3]*f}a.putImageData(O,0,0);W+=.03},T=0)
</script>

</body>
</html>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值