|
Flash CS4 Resources |
Using winding rulesThese fill rules are complicated, but in some situations they are necessary. For example, consider drawing a star shape. With the standard even-odd rule, the shape would require ten different lines. With the non-zero winding rule, those ten lines are reduced to five. Here is the ActionScript for a star with five lines and a non-zero winding rule: graphics.beginFill(0x60A0FF); graphics.drawPath( Vector.<int>([1,2,2,2,2]), Vector.<Number>([66,10, 23,127, 122,50, 10,49, 109,127]), GraphicsPathWinding.NON_ZERO); And here is the star shape: ![]() A star shape using different winding rules
And, as images are animated or used as textures on three-dimensional objects and overlap, the winding rules become more important. |