This repository has been archived by the owner on Dec 21, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7a1075
commit 194b335
Showing
11 changed files
with
493 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
ART.Group {#ART-Group} | ||
====================== | ||
|
||
ART.Group is used to combine shapes or other groups into hierarchies that can be | ||
transformed as a set. | ||
|
||
ART.Group implements [ART.Transform][] as a mixin which means it has all transform | ||
methods available for moving, scaling and rotating a shape. | ||
|
||
ART.Group method: constructor | ||
----------------------------- | ||
|
||
Creates a new group. | ||
|
||
### Syntax: | ||
|
||
var group = new ART.Group([width, height]); | ||
|
||
### Arguments: | ||
|
||
1. width - (*number*, optional) The width of the shape in pixels. | ||
2. height - (*number*, optional) The height of the shape in pixels. | ||
|
||
The size is optional and defines a content box which can be scaled to fit a new | ||
size using the [resizeTo method](ART.Transform#ART-Transform:resizeTo). | ||
|
||
ART.Group method: inject {#ART-Group:inject} | ||
-------------------------------------------- | ||
|
||
Injects a group into another group or [ART][] surface instance. | ||
|
||
This group is rendered in front of any existing content in the container. | ||
|
||
### Syntax: | ||
|
||
group.inject(container); | ||
|
||
### Arguments: | ||
|
||
1. container - (*mixed*) an [ART][] surface instance or another ART.Group | ||
|
||
### Returns: | ||
|
||
* The ART.Group instance itself | ||
|
||
### Example: | ||
|
||
var art = new ART(500, 500); | ||
var group = new ART.Group().inject(art); | ||
|
||
ART.Group method: grab {#ART-Group:grab} | ||
---------------------------------------- | ||
|
||
Grabs one or more groups or [ART.Shape][] instances and injects them into this group's | ||
content. The child instances are ejected from their current container. | ||
|
||
The new children are rendered in front of any current group content. | ||
|
||
### Syntax: | ||
|
||
group.grab(child[, child[, ...]]); | ||
|
||
### Arguments: | ||
|
||
1. child - (*mixed*) a shape, text or another group instance | ||
|
||
### Returns: | ||
|
||
* The ART.Group instance itself | ||
|
||
### Example: | ||
|
||
var art = new ART(500, 500); | ||
var rectangle = new ART.Rectangle(400, 200).fill('black'); | ||
var circle = new ART.Ellipse(200).fill('red'); | ||
var group = new ART.Group() | ||
.grab(rectangle, circle) | ||
.inject(art); | ||
|
||
ART.Group method: eject {#ART-Group:eject} | ||
------------------------------------------ | ||
|
||
Removes the group from it's current container. Leaving it free to be garbage collected | ||
or injected somewhere else. | ||
|
||
### Syntax: | ||
|
||
group.eject(); | ||
|
||
### Returns: | ||
|
||
* The ART.Group instance itself | ||
|
||
### Example: | ||
|
||
var art = new ART(500, 500); | ||
var group = new ART.Group().inject(art); | ||
var square = new ART.Rectangle(200).fill('black').inject(group); | ||
art.subscribe('click', function(){ | ||
group.eject(); | ||
}); | ||
|
||
|
||
[ART]: ../ART/ART | ||
[ART.Transform]: ../ART/ART.Transform | ||
[ART.Shape]: ../ART/ART.Shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.