Animate a Canvas circle to draw on load

前端 未结 2 1656
花落未央
花落未央 2020-12-15 13:40

OK Hello.

I\'ve decided to start using HTML canvas for a small project I have.

There\'s no real start yet. I\'m just learning the basics of Canvas and I want

2条回答
  •  遥遥无期
    2020-12-15 13:55

    Three steps:

    1) Make an "init" function which will assign the variables (they aren't in any   
    function).  
    2) Then use requestAnimationFrame, or setInterval with your   
    drawing function you will create.  
    3) In this "drawing/updating" function you're going to   
    write your code to do the maths and then just animate the updated circle.    
    

    There aren't any functions in your code. If you don't know how to make functions and use them + what is global variable it's better to read first a tutorials about that but anyway I'll try to make you an example :)

提交回复
热议问题