new StageScaleMode(game, width, height)
An Animation instance contains a single animation and the controls to play it. It is created by the AnimationManager, consists of Animation.Frame objects and belongs to a single Game Object such as a Sprite.
Parameters:
| Name | Type | Description |
|---|---|---|
game |
Phaser.Game | A reference to the currently running game. |
width |
number | Description. |
height |
number | Description. |
- Source:
Members
-
<static, constant> EXACT_FIT :number
-
Type:
- number
- Source:
-
<static, constant> NO_SCALE :number
-
Type:
- number
- Source:
-
<static, constant> SHOW_ALL :number
-
Type:
- number
- Source:
-
aspectRatio
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description aspectRationumber Aspect ratio.
-
enterLandscape
-
- Source:
Properties:
Name Type Description enterLandscapeDescription Description.
-
enterPortrait
-
- Source:
Properties:
Name Type Description enterPortraitDescription Description.
-
forceLandscape
-
- Default Value:
- false
- Source:
Properties:
Name Type Description forceLandscapeboolean If the game should be forced to use Landscape mode, this is set to true by Game.Stage
-
forcePortrait
-
- Default Value:
- false
- Source:
Properties:
Name Type Description forcePortraitboolean If the game should be forced to use Portrait mode, this is set to true by Game.Stage
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game A reference to the currently running game.
-
height
-
- Source:
Properties:
Name Type Description heightnumber Height of the stage after calculation.
-
incorrectOrientation
-
- Default Value:
- false
- Source:
Properties:
Name Type Description incorrectOrientationboolean If the game should be forced to use a specific orientation and the device currently isn't in that orientation this is set to true.
-
<readonly> isFullScreen
-
- Source:
Properties:
Name Type Description isFullScreenboolean Returns true if the browser is in full screen mode, otherwise false.
-
<readonly> isLandscape
-
- Source:
Properties:
Name Type Description isLandscapeboolean Returns true if the browser dimensions match a landscape display.
-
<readonly> isPortrait
-
- Source:
Properties:
Name Type Description isPortraitboolean Returns true if the browser dimensions match a portrait display.
-
maxHeight
-
- Default Value:
- null
- Source:
Properties:
Name Type Description maxHeightnumber Maximum height the canvas should be scaled to (in pixels). If null it will scale to whatever height the browser can handle.
-
maxIterations
-
- Default Value:
- 5
- Source:
Properties:
Name Type Description maxIterationsnumber The maximum number of times it will try to resize the canvas to fill the browser.
-
maxWidth
-
- Default Value:
- null
- Source:
Properties:
Name Type Description maxWidthnumber Maximum width the canvas should be scaled to (in pixels). If null it will scale to whatever width the browser can handle.
-
minHeight
-
- Default Value:
- null
- Source:
Properties:
Name Type Description minHeightnumber Minimum height the canvas should be scaled to (in pixels).
-
minWidth
-
- Default Value:
- null
- Source:
Properties:
Name Type Description minWidthnumber Minimum width the canvas should be scaled to (in pixels).
-
pageAlignHorizontally
-
- Default Value:
- false
- Source:
Properties:
Name Type Description pageAlignHorizontallyboolean If you wish to align your game in the middle of the page then you can set this value to true. <ul><li>It will place a re-calculated margin-left pixel value onto the canvas element which is updated on orientation/resizing.</li> <li>It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.</li></ul>
-
pageAlignVertically
-
- Default Value:
- false
- Source:
Properties:
Name Type Description pageAlignVerticallyboolean If you wish to align your game in the middle of the page then you can set this value to true. <ul><li>It will place a re-calculated margin-left pixel value onto the canvas element which is updated on orientation/resizing. <li>It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.</li></ul>
-
scaleFactor
-
- Source:
Properties:
Name Type Description scaleFactorDescription Description.
-
width
-
- Source:
Properties:
Name Type Description widthnumber Width of the stage after calculation.
Methods
-
checkOrientation(event)
-
Handle window.orientationchange events
Parameters:
Name Type Description eventEvent The orientationchange event data.
- Source:
-
checkOrientationState()
-
Checks if the browser is in the correct orientation for your game (if forceLandscape or forcePortrait have been set)
- Source:
-
checkResize(event)
-
Handle window.resize events
Parameters:
Name Type Description eventEvent The resize event data.
- Source:
-
<protected> fullScreenChange(event)
-
Called automatically when the browser enters of leaves full screen mode.
Parameters:
Name Type Description eventEvent The fullscreenchange event
- Source:
-
refresh()
-
Re-calculate scale mode and update screen size.
- Source:
-
setExactFit()
-
Sets the width and height values of the canvas, no larger than the maxWidth/Height.
- Source:
-
setMaximum()
-
Sets this.width equal to window.innerWidth and this.height equal to window.innerHeight
- Source:
-
setScreenSize(force)
-
Set screen size automatically based on the scaleMode.
Parameters:
Name Type Description forceDescription If force is true it will try to resize the game regardless of the document dimensions.
- Source:
-
setShowAll()
-
Calculates the multiplier needed to scale the game proportionally.
- Source:
-
setSize()
-
Sets the canvas style width and height values based on minWidth/Height and maxWidth/Height.
- Source:
-
startFullScreen(antialias)
-
Tries to enter the browser into full screen mode. Please note that this needs to be supported by the web browser and isn't the same thing as setting your game to fill the browser.
Parameters:
Name Type Description antialiasboolean You can toggle the anti-alias feature of the canvas before jumping in to full screen (false = retain pixel art, true = smooth art)
- Source:
-
stopFullScreen()
-
Stops full screen mode if the browser is in it.
- Source: