Skip to content

Docs Module VCam

Carlonn Rivers edited this page Sep 5, 2021 · 4 revisions

Virtual Camera

Properties

Property Description Type Default
type The flobtive's description type.
readonly
_anchorX The horizontal axis of the virtual camera, in percentage.
Min: 0 | Max: 100
number 0
_anchorY The vertical axis of the virtual camera, in percentage.
Min: 0 | Max: 100
number 0
_height The vertical dimension of the virtual camera, in pixels. number _root._height
_rotation The rotation of the virtual camera, in degrees, from its original orientation.
Min: -179 | Max: 180
number 0
_width The horizontal dimension of the virtual camera, in pixels. number _root._width
_x The horizontal position / x coordinate of the virtual camera relative to the coordinates of the stage.
Smaller values to the left, larger values to the right.
number 0
_xScale Determines the horizontal scale of the virtual camera relative to the anchor point, in percentage. number 100
_xmouse The horizontal position / x coordinate of the mouse relative to the coordinates of the virtual camera, in pixels.
Smaller values to the left, larger values to the right.
readonly
number
_xmouseMov The horizontal movement of the mouse coordinates, in pixels.
Negative values when moved left, positive values when moved right.
readonly
number
_y The vertical position / y coordinate of the virtual camera relative to the coordinates of the stage.
Smaller values to the top, larger values to the bottom.
number 0
_yScale Determines the vertical scale of the virtual camera relative to the anchor point, in percentage. number 100
_ymouse The vertical position / y coordinate of the mouse relative to the coordinates of the virtual camera, in pixels.
Smaller values to the top, larger values to the bottom.
readonly
number
_ymouseMov The vertical movement of the mouse coordinates, in pixels.
Negative values when moved up, positive values when moved down.
readonly
number

Method Summary

Method Description
mapPointToStage() Converts the point object from the virtual camera's screen coordinates to the stage's global coordinates.

Methods

mapPointToStage(point, return)

Converts the point object from the virtual camera's screen coordinates to the stage's global coordinates. Screen coordinates relate to the top-left corner of the viewing screen. Global coordinates relate to the top-left corner of the stage.

Parameters

  • point
    • Type: object
    • An object with x and y coordinates.
  • return
    • Type: boolean
    • Default: false
    • Determines whether the point is modified (false) or a new point is returned (true).

Notes

  • The virtual camera's coordinates are expressed using _x and _y, because those are the prefab properties that you use to set the x and y values for FlevaClips. However, your generic object uses x and y without the underscore.

Example

Assuming the virtual camera is located at _x: 100 and _y: 100:

/* Within scene onload */
const myPoint = { x: -50, y: 80 };

// map the point to the stage's coordinates
VCam.mapPointToStage(myPoint);

// trace the coordinates of the myPoint
flevar.trace(myPoint);

// > { x: 50, y: 180 }

*(Working Draft)

Clone this wiki locally