0

I am doing some math projects that require a lot of vector line art--that is a line drawn between to points with a circle at the start point and an arrow at the end point. A call to Math.atan2() keeps the arrow aligned. I call this class DrawVectorLineArt() and it creates instances of 2 other custom classes DrawArrow() and DrawCircle().

So far so good--DrawVectorLineArt() draws just what I need. Now I need to animate the vector art. So in a function onEnterFrame I want to update the postion of arrow and circle, the objects created by DrawArrow() and DrawCircle(), respectively. I also need to clear and redraw the line drawn between them. At this point I am not sure how to proceed in an OOP framework. Do I need to create methods of my custorm class DrawVectorLineArt() to update the position of arrow and circle and subsequently clear and redraw the connecting line?

Any advice or links appreciated. Thanks!

4

1 回答 1

0

“我是否需要创建我的 custorm 类 DrawVectorLineArt() 的方法来更新箭头和圆圈的位置,然后清除并重绘连接线?”

是的。

箭头和圆圈都是 DrawVectorLineArt 的成员,按照名称和成员的选择,线也应如此(如果它是通过实际数据实现的)。DrawVectorLineArt 应该包含并实现圆、箭头和线之间的整个动画。因此,如果动画应该能够在创建后更改,则 DrawVectorLineArt 的同一实例应该能够获取提供给它的任何两个合法点(或者它会在内部意识到,这取决于你在做什么),重新定位三个组件,并在其自己的代码中适当地转动箭头和线。

于 2013-03-02T20:53:30.633 回答