菜单

HTML5 椭圆(蛋)运动的小球

2019年8月15日 - 金沙前端

                            //每秒60次

                    }

               //在画板中间绘制球

            //存放小球走过的点

                            angle+=speedAngle;

 

 

 

var
canvas=document.getElementById(ball布罗兹); var
context=canvas.getContext(2d); //角度 var angle=0; //角度步长 var
speedAngle=0.1; //刷新频率 v…

           }   

 

 

作者:Louja

           {

            context.fillStyle = ball.color;

            

           

                this.color=color;

            }

           function DrawText(text,x,y)

            //刷新频率

           drawAsync().start();

            var angle=0;

                        while(true)

           

            var Ball=function(radius,color,x,y)

                        context.stroke();

                       

            //在画板中间绘制球

           

 

            {

            //points.push({x:newBall.x,y:newBall.y});

           }

                            //存放小球的点

            //存放

            var points=[];

            context.stroke();

            context.arc(ball.x, ball.y, newBall.radius, 0, 2 * Math.PI,
false);

            }));

            //DrawBall(newBall);

                            DrawBall(newBall);

                this.y=y;

                this.radius=radius;

           function DrawBall(ball)

                context.font = “40pt Arial”;

           {

                           

椭圆与椭圆运动:

           //写蛋疼

            context.fill();

            //球对象

           function DrawBallLine()

                           

            var centerX=canvas.width/2;

 

                            context.moveTo(points[i].x,points[i].y)

           

            context.beginPath();

                            DrawBallLine();

                    for(var i=0;i<points.length;i++)

            //创制一球

            context.strokeStyle = “#ff0000”;

            //让球平稳的动起来

            var frames=1000/60;

                           
newBall.y=centerY+Math.sin(angle)*(centerY/2+20);

                            //绘制线条

                            DrawText(“蛋疼”,centerX-50,centerY);

            var centerY=canvas.height/2;

                        }   

            context.lineWidth = 5;

                            points.push({x:newBall.x,y:newBall.y});

            //角度步长

                        {

                        {

 

           

            var drawAsync = eval(Jscex.compile(“async”, function () {

           }

           {

           //绘制小球的移位轨迹

            //中心点

               context.clearRect(0, 0, canvas.width, canvas.height);

            //角度

            var context=canvas.getContext(“2d”);

                            $await(Jscex.Async.sleep(frames));

                            //画蛋疼

 

 

             context.fillText(text, x, y);

          

                    {

 

 

            var speedAngle=0.1;

                                                                   

                this.x=x;

                            newBall.x=centerX+Math.cos(angle)*centerX;

            var newBall=new Ball(20,”#ff000″,0,centerY);

             var canvas=document.getElementById(“ballBroad”);

                        if(i==0)

                        }

                        context.lineTo(points[i].x,points[i].y)

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图