HTML5练习(2)陪你去看流星雨

这篇博客继续深入HTML5的学习,通过canvas元素来实现一个流星雨的动画效果。内容涵盖如何创建流星对象,利用canvas绘图API动态模拟流星轨迹。
摘要由CSDN通过智能技术生成

在上一篇的基础上
1、新增流星雨对象

 
//
var  MeteorRain  =  function ( ) {
     this . x  =  -1 ;
     this . y  =  -1 ;
     this . length  =  -1 ; //
     this . angle  =  30 ;  //
     this . width  =  -1 ; //
     this . height  =  -1 ; //
     this . speed  =  1 ; //
     this . offset_x  =  -1 ; //
     this . offset_y  =  -1 ; //
     this . alpha  =  1 ;  //
     this . color1  =  "" ; //
     this . color2  =  "" ;   //
     /************************************/
     this . init  =  function  ( )  //
     {
         this . getPos ( ) ;
         this . alpha  =  1 ; //
         this . getRandomColor ( ) ;
         //
         var  x  =  Math . random ( )  *  80  +  150 ;
         this . length  =  Math . ceil ( x ) ;
//                  x = Math.random()*10+30;
         this . angle  =  30 ;  //
         x  =  Math
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值