LevelTransition

Manage the transition between levels

Author
  • Mark Mayes / mm-dev
License
  • GPL-3.0-only

Methods

(static) getColorBlendDetails(_propertyInfo) → {object}

Source
Get info about how to transition a colour
  • Most colour data in the game is stored as hex values
  • Convert those to RGB(/A) values, so that each channel can have its transition steps calculated
Parameters
Name Type Description
_propertyInfo object

Info about this property from LevelTransition.propertiesInfo

Returns
  object

Describing the current value, the aim, and steps to get there

(static) getNestedPropertyValue(_object, _nestedProperty) → {object}

Source
Dynamically retrieve a nested property from an object

Given an object, convert string-based dot notation into square bracket notation to access the property, so eg if the object is:

object1 = {
  child: {
    grandchild: {
      type: "flower"
    }
  }
}

getNestedPropertyValue(object1, "child.grandchild.type")
// output: "flower"
Parameters
Name Type Description
_object object

The parent object which is to be searched

_nestedProperty string

The (potentially) nested property as a dot-separated string

Returns
  object

The discovered value

(static) getNumberBlendDetails(_propertyInfo) → {object}

Source
Get info about how to transition a number
Parameters
Name Type Description
_propertyInfo object

Info about this property from LevelTransition.propertiesInfo

Returns
  object

Describing the current value, the aim, and steps to get there

(static) nextFrame()

Source
Perform the next step of the level outro sequence
  • Move from old level colours to the next level colours
  • Move from old level numeric values to the next level numeric values

(static) setupFades()

Source
Loop through each of the properties we want to transition and work out how to achieve the change over LevelTransition.totalFrames number of frames

(static) startLevelOutro()

Source
Start level outro sequence