English 中文(简体)
• 如何让一个圈子走 can路?
原标题:How to have a circle follow path in canvas?

我希望用户能够点击Sevas的3个点,为每个被点击的地点形成2个线段,每个带3个圈子。 当用户点击一个 but子时,一个红色圈子在用户点击的第一圈子上显示,然后沿着用户走的道路。 在进入第二圈并最终进入最后一圈时,某些形式的警惕一旦到达了这些点。

最佳回答

I am not going to make all of this for you. However, here is a starting point

1) Make sure you can capture mouse events in the canvas. This question will get you started Html5 canvas and jquery

2) 理解你正在讨论的问题。 你们需要这样的数据结构:

points{
    a : {x : None, y : None},
    b : {x : None, y : None},
    c : {x : None, y : None}  
};

3) Everytime the user clicks, update a, then b, then c. When you get to c, use trigonometry to animate the line being drawn. This can be done with setTimeout or setInterval

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签