b5.RectActor
A RectActor is derived from an Actor and displays a rectangular shaped game object instead of an image and inherits all properties, functions and so forth from its parent. A RectActor should be added to a Scene or another Actor once created.
Public properties
- fill_style – Style used to fill the rect
- stroke_style – Stroke used to draw none filled rect
- stroke_thickness – Thickness of line stroke
- filled – if true then rect interior will filled otherwise empty
- corner_radius – Radius of corner for rounded rects
Methods
RectActor() – Creates an instance of a RectActor object
draw() – Draws a rect actor and its children, this method can be overriden by derived actors
drawToCache() – Draws this actor to a cached canvas, subsequent calls to draw() will cause this cached canvas to be drawn instead
update(dt) – Updates the actor, this method can be overriden by derived actors
- dt – The amount of time that has passed since this actor was last updated
Examples
Example showing how to create a rect actor
1 2 3 4 5 6 |
var actor = new b5.RectActor(); actor.fill_style = "#40ff4f"; // Set fill style actor.filled = true; // Set filled actor.w = 100; actor.h = 100; scene.addActor(actor); // Add actor to scene for processing and drawing |
701 total views, 1 views today