Set the fill style (fill or line must be set for the shape to be visible).The overall flow for drawing with the Shape class is: The “lineTo” function draws a straight line from current pen location to the destination location. The “moveTo” function can be thought of as lifting a pen off the paper and moving it to a different location without drawing anything. Since a path can only have one line style and one fill style, multiple paths are required to use different line / fill styles within a shape.Ī pen & paper analogy is often used to describe the drawing approach used by the Shape class. A different line or fill style can be used for each path. Each path consists of zero or more lines with the same line and fill style. The x axis is the same as the standard cartesian coordinate system. The origin point in the Gideros coordinate system is in the upper left hand corner of the screen with an inverted y axis (i.e., y values are negative above the origin and positive below the origin). The x values increase to the right horizontally and the y values increase upwards vertically (i.e., x values are negative to the left of the origin and positive to the right, y values are negative below the origin and positive above). The standard cartesian coordinate system that everyone learns in school consists of an origin point (x=0, y=0) which is often drawn in center of the page. Graphs (e.g., stock prices, bar-charts).Drawing tool (e.g., drawing lines based on user input).However, there are cases where you don’t know which graphics you need in advance: One question that you might ask is: Why draw using this primitive API? Wouldn’t it be better to use some other authoring environment (e.g., Photoshop, Inkscape, Gimp) then import the image as a Texture? In most cases, an authoring tool is the right answer. The unique functions added by the Shape class are:ĭraws a line from the current location to the specified pointĭraws a line from the current location to the first point in the pathĬlears all paths from the shape and resets the line and fill style to default values See the chapter on Sprites for a full list of inherited capabilities. Since the Shape class inherits from Sprite (which itself inherits from EventListener), instances of the shape class can be rotated, scaled, positioned on the screen, listen for and dispatch events - basically anything that Sprites can do. It is similar to the drawing API found in Flash although at the moment it only has a subset of Flash’s capabilities. Gideros provides a Shape class for drawing primitive shapes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |