new Application(content [, container] [, options])
Create an application from instance of Creap.Content.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
content |
Creap.Content | Target content. |
||
container |
HTMLElement |
<optional> |
document.body | The parent element of the canvas that displays the content. |
options |
Creap.ApplicationOption |
<optional> |
Optional data related to Creep.Application. |
Fires:
Extends
- Emitter
Members
-
app :PIXI.Application
-
Target application.
Type:
- PIXI.Application
-
container :HTMLElement
-
Container element.
Type:
- HTMLElement
-
content :Creap.Content
-
Target content.
Type:
-
isBuilt :bool
-
Whether application was bulit.
"built" means that the root of the content has been instantiated.Type:
- bool
-
isInitialized :bool
-
Whether application was initialized.
"initialized" refers to whether all the assets required for the content have been loaded.Type:
- bool
-
isStarted :bool
-
Whether application was start.
"start" means that the application's ticker has started.Type:
- bool
-
stage :createjs~Stage
-
Top level container in application.
Type:
-
view :HTMLCanvasElement
-
Target canvas.
Type:
- HTMLCanvasElement
-
wrapper :HTMLDivElement
-
Wrapper element.
Type:
- HTMLDivElement
Methods
-
adjustHeight(width)
-
Adjust height of the content.
This function changes "canvas.style.height".Parameters:
Name Type Description width
number Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
adjustWidth(width)
-
Adjust width of the content.
This function changes "canvas.style.width".Parameters:
Name Type Description width
number Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
defineBitmap(libName, imageName)
-
Define a new bitmap symbol.
It is mainly used when the number of images to be inserted from the outside is not fixed.
If the quantity is fixed, please use Creap.Content#defineImages or Creap.Application#defineImages and replace the image.Parameters:
Name Type Description libName
string Name of definition to change in content.
imageName
string Image identifier.
- Since:
-
- 1.1.7
- Source:
- See:
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Content
-
defineImages(obj, callback)
-
Define images to the content.
If already defined, replace that definition.Parameters:
Name Type Description obj
object.<string, ImageDefinitionData> | object.<string, string> key: Image identifier
value: Image definition data | Image URL.callback
function Callback when images loaded.
Context 'this' in callback is Creap.Application.Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
defineVars(obj)
-
Define variables to instance of root object.
Parameters:
Name Type Description obj
object.<string, *> key: Name of variable.
value: Value of variable.Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
fullScreen()
-
Display the content in full screen.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
getPoint()
-
Get the top-left coordinates of the application.
Returns:
- Type
- Creap.Point
-
getRect()
-
Gets a rectangle representing the display area of the application.
Returns:
- Type
- Creap.Rect
-
getSize()
-
Get the size of the application.
Returns:
- Type
- Creap.Size
-
hide()
-
Hide the content.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
pause(isPause)
-
Pause or restart the content.
Parameters:
Name Type Description isPause
bool Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
show()
-
Show the content.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
start()
-
Build and start the content.
Fires:
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
stop()
-
Stop the content.
Fires:
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
toBottom( [rect])
-
Align the content to the bottom with respect to the vertical direction of the reference rectangle.
This function changes "canvas.parentNode.style.top".Parameters:
Name Type Argument Default Description rect
Creap.Rect <optional>
new Rect(0, 0, windowWidth, windowHeight) Reference rectangle.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
toCenter( [rect])
-
Align the content to the center with respect to the horizontal direction of the reference rectangle.
This function changes "canvas.parentNode.style.left".Parameters:
Name Type Argument Default Description rect
Creap.Rect <optional>
new Rect(0, 0, windowWidth, windowHeight) Reference rectangle.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
toLeft( [rect])
-
Align the content to the left with respect to the horizontal direction of the reference rectangle.
This function changes "canvas.parentNode.style.left".Parameters:
Name Type Argument Default Description rect
Creap.Rect <optional>
new Rect(0, 0, windowWidth, windowHeight) Reference rectangle.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
toMiddle( [rect])
-
Align the content to the center with respect to the vertical direction of the reference rectangle.
This function changes "canvas.parentNode.style.top".Parameters:
Name Type Argument Default Description rect
Creap.Rect <optional>
new Rect(0, 0, windowWidth, windowHeight) Reference rectangle.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
toRight( [rect])
-
Align the content to the right with respect to the horizontal direction of the reference rectangle.
This function changes "canvas.parentNode.style.left".Parameters:
Name Type Argument Default Description rect
Creap.Rect <optional>
new Rect(0, 0, windowWidth, windowHeight) Reference rectangle.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application
-
toTop( [rect])
-
Align the content to the top with respect to the vertical direction of the reference rectangle.
This function changes "canvas.parentNode.style.top".Parameters:
Name Type Argument Default Description rect
Creap.Rect <optional>
new Rect(0, 0, windowWidth, windowHeight) Reference rectangle.
Returns:
Return a itself (can use method chaining).
- Type
- Creap.Application