鱼C论坛

 找回密码
 立即注册
查看: 1241|回复: 1

[作品展示] 可以将此代码输入进文本文档另存为.html文件生成圣诞树

[复制链接]
发表于 2021-12-19 20:38:09 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 槐月余八 于 2021-12-20 00:11 编辑
  1. <!DOCTYPE HEML PUBLIC>
  2. <html>
  3.     <head>
  4.     <meta charset="utf-8">
  5.         <style>
  6.             html, body
  7.             {
  8.                 width: 100%;
  9.                 height: 100%;
  10.                 margin: 0;
  11.                 padding: 0;
  12.                 border: 0;
  13.             }
  14.             
  15.             div
  16.             {
  17.                 margin: 0;
  18.                 padding: 0;
  19.                 border: 0;
  20.             }
  21.             .nav
  22.             {
  23.                 position: absolute;
  24.                 top: 0;
  25.                 left: 0;
  26.                 width: 100%;
  27.                 height: 27px;
  28.                 background-color: white;
  29.                 color: black;
  30.                 text-align: center;
  31.                 line-height: 25px;
  32.             }
  33.             a
  34.             {
  35.                 color: black;
  36.                 text-decoration: none;
  37.                 border-bottom: 1px dashed black;
  38.             }
  39.             a:hover
  40.             {
  41.                 border-bottom: 1px solid red;
  42.             }
  43.             .previous
  44.             {
  45.                 float: left;
  46.                 margin-left: 10px;
  47.             }
  48.             .next
  49.             {
  50.                 float: right;
  51.                 margin-right: 10px;
  52.             }
  53.             .green
  54.             {
  55.                 color: green;
  56.             }
  57.             .red
  58.             {
  59.                 color: red;
  60.             }
  61.             textarea
  62.             {
  63.                 width: 100%;
  64.                 height: 100%;
  65.                 border: 0;               
  66.                 padding: 0;               
  67.                 margin: 0;               
  68.                 padding-bottom: 20px;              
  69.             }            
  70.             .block-outer            
  71.             {               
  72.                 float: left;               
  73.                 width: 22%;               
  74.                 height: 100%;               
  75.                 padding: 5px;               
  76.                 border-left: 1px solid black;               
  77.                 margin: 30px 3px 3px 3px;               
  78.             }            
  79.             .block-inner            
  80.             {               
  81.                 height: 68%;               
  82.             }            
  83.             .one            
  84.             {               
  85.                 border: 0;               
  86.             }
  87.         </style>      
  88.     </head>      
  89. <body marginwidth="0" marginheight="0">
  90.     <canvas id="c" height="356" width="446">
  91.     <script>              
  92.         var collapsed = true;            
  93.         function toggle()            
  94.         {                  
  95.             var fs = top.document.getElementsByTagName('frameset')[0];               
  96.             var f = fs.getElementsByTagName('frame');               
  97.             if (collapsed)               
  98.             {                     
  99.                 fs.rows = '250px,*';                    
  100.                 fs.noResize = false;                    
  101.                 f[0].noResize = false;                     
  102.                 f[1].noResize = false;
  103.             }                 
  104.             else
  105.             {                     
  106.                 fs.rows = '30px,*';
  107.                 fs.noResize = true;
  108.                 f[0].noResize = true;
  109.                 f[1].noResize = true;
  110.             }                  
  111.             collapsed = !collapsed;            
  112.         }
  113.     </script>  
  114.     <script>              
  115.         var b = document.body;            
  116.         var c = document.getElementsByTagName('canvas')[0];            
  117.         var a = c.getContext('2d');            
  118.         document.body.clientWidth;
  119.     </script>  
  120.     <script>
  121.         M=Math;
  122.         Q=M.random;J=[];
  123.         U=16;
  124.         T=M.sin;
  125.         E=M.sqrt;
  126.         for(O=k=0;x=z=j=i=k<200;)
  127.         with(M[k]=k?c.cloneNode(0):c)
  128.         {   
  129.             width=height=k?32:W=446;        
  130.             with(getContext('2d'))        
  131.             if(k>10|!k)        
  132.             for(        
  133.             font='60px Impact',        
  134.             V='rgba(';I=i*U,fillStyle=k?k==13?V+'205,205,215,.15)':        
  135.             V+(147+I)+','+(k%2?128+I:0)+','+I+',.5)':'#cca',i<7;        
  136.             )   
  137.             beginPath(        
  138.             fill(            
  139.             arc(               
  140.             U-i/3,               
  141.             24-i/2,               
  142.             k==13?4-(i++)/2:8-i++,               
  143.             0,               
  144.             M.PI*2,1               
  145.             )            
  146.             )            
  147.             );
  148.             else for(;
  149.             x=T(i),        
  150.             y=Q()*2-1,        
  151.             D=x*x+y*y,        
  152.             B=E(D-x/.9-1.5*y+1),        
  153.             R=67*(B+1)*(L=k/9+.8)>>1,        
  154.             i++<W;        
  155.             )
  156.             if(D<1)   
  157.             beginPath(        
  158.             strokeStyle=V+R+','+(R+B*L>>0)+',40,.1)'        
  159.             ),        
  160.             moveTo(U+x*8,U+y*8),        
  161.             lineTo(U+x*U,U+y*U),        
  162.             stroke();
  163.             for(        
  164.             y=H=k+E(k++)*25,        
  165.             R=Q()*W;        
  166.             P=3,j<H;        
  167.             )   
  168.             J[O++]=[x+=T(R)*P+Q()*6-3,y+=Q()*U-8,z+=T(R-11)*P+Q()*6-3,j/H*20+((j+=U)>H&Q()>.8?Q(P=9)*4:0)>>1]
  169.         }
  170.         setInterval(function G(m,l)
  171.         {   
  172.             A=T(D-11);   
  173.             if(l)
  174.             return(        
  175.             m[2]-l[2])*A+(l[0]-m[0])*T(D);        
  176.             a.clearRect(0,0,W,W);        
  177.             J.sort(G);
  178.             for(        
  179.             i=0;        
  180.             L=J[i++];        
  181.             a.drawImage        
  182.             (            
  183.             M[L[3]+1],207+L[0]*A+L[2]*T(D)>>0,L[1]>>1)    )   
  184.             {        
  185.                 if(i==2e3)        
  186.                 a.fillText        
  187.                 (            
  188.                 'Happy Christmas!',            
  189.                 U,345);
  190.                 if(!(i%7))        
  191.                 a.drawImage        
  192.                 (
  193.                 M[13],
  194.                 ((157*(i*i)+T(D*5+i*i)*5)%W)>>0,
  195.                 ((113*i+(D*i)/60)%(290+i/99))>>0
  196.                 );
  197.             }   
  198.             D+=.02
  199.         },1)
  200.     </script>
  201. </body>
  202. </html>
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-12-20 01:01:46 | 显示全部楼层

                               
登录/注册后可看大图
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-30 18:32

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表