RuntimeBehavior represents a behavior being used by a RuntimeObject.

Hierarchy (view full)

Constructors

Properties

name: string

The object owning the behavior

type: string

Methods

  • Tween a color object effect property.

    Parameters

    • effectBehavior: any

      Only used by events can be set to null

    • identifier: string

      Unique id to identify the tween

    • toColorStr: string

      The target RGB color (format "128;200;255" with values between 0 and 255 for red, green and blue)

    • effectName: string

      Effect name

    • propertyName: string

      Property name

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween a numeric object effect property.

    Parameters

    • effectBehavior: any

      Only used by events can be set to null

    • identifier: string

      Unique id to identify the tween

    • toValue: number

      The targeted value

    • effectName: string

      Effect name

    • propertyName: string

      Property name

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object angle.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toAngle: number

      The target angle

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectAngleTween2 instead.

  • Tween an object angle.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toAngle: number

      The target angle

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object HSL color, with the "to" color given using HSL (H: any number, S and L: 0-100).

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toHue: number

      The target hue, or the same as the from color's hue if blank

    • animateHue: boolean

      include hue in calculations, as can't set this to -1 as default to ignore

    • toSaturation: number

      The target saturation, or the same as the from color's saturation if blank

    • toLightness: number

      The target lightness, or the same as the from color's lightness if blank

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectColorHSLTween2 instead.

  • Tween an object HSL color, with the "to" color given using HSL (H: any number, S and L: 0-100).

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toHue: number

      The target hue, or the same as the from color's hue if blank

    • animateHue: boolean

      include hue in calculations, as can't set this to -1 as default to ignore

    • toSaturation: number

      The target saturation, or the same as the from color's saturation if blank

    • toLightness: number

      The target lightness, or the same as the from color's lightness if blank

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object color.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toColorStr: string

      The target RGB color (format "128;200;255" with values between 0 and 255 for red, green and blue)

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • useHSLColorTransition: boolean

      Tween using HSL color mappings, rather than direct RGB line

    Returns void

    Deprecated

    Use addObjectColorTween2 instead.

  • Tween an object color.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toColorStr: string

      The target RGB color (format "128;200;255" with values between 0 and 255 for red, green and blue)

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • useHSLColorTransition: boolean = true

      Tween using HSL color mappings, rather than direct RGB line

    Returns void

  • Tween an object depth.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toDepth: number

      The target depth

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectDepthTween2 instead.

  • Tween an object depth.

    Parameters

    • object3DBehavior: any

      Only used by events can be set to null

    • identifier: string

      Unique id to identify the tween

    • toDepth: number

      The target depth

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object height.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toHeight: number

      The target height

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectHeightTween2 instead.

  • Tween an object height.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toHeight: number

      The target height

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object opacity.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toOpacity: number

      The target opacity

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectOpacityTween2 instead.

  • Tween an object opacity.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toOpacity: number

      The target opacity

    • easing: string

      Easing function identifier

    • duration: number

      Duration in second

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object position.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toX: number

      The target X position

    • toY: number

      The target Y position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectPositionTween2 instead.

  • Tween an object position.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toX: number

      The target X position

    • toY: number

      The target Y position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object X position.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toX: number

      The target X position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectPositionXTween2 instead.

  • Tween an object X position.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toX: number

      The target X position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object Y position.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toY: number

      The target Y position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectPositionYTween2 instead.

  • Tween an object Y position.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toY: number

      The target Y position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object Z position.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toZ: number

      The target Z position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectPositionZTween2 instead.

  • Tween an object Z position.

    Parameters

    • object3DBehavior: any

      Only used by events can be set to null

    • identifier: string

      Unique id to identify the tween

    • toZ: number

      The target Z position

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween a 3D object rotation X.

    Parameters

    • object3DBehavior: any

      Only used by events can be set to null

    • identifier: string

      Unique id to identify the tween

    • toAngle: number

      The target angle

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween a 3D object rotation Y.

    Parameters

    • object3DBehavior: any

      Only used by events can be set to null

    • identifier: string

      Unique id to identify the tween

    • toAngle: number

      The target angle

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween an object scale.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toScaleX: number

      The target X-scale

    • toScaleY: number

      The target Y-scale

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • scaleFromCenterOfObject: boolean

      Scale the transform from the center of the object (or point that is called center), not the top-left origin

    Returns void

    Deprecated

    Use addObjectScaleTween2 instead.

  • Tween an object scale.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toScaleX: number

      The target X-scale

    • toScaleY: number

      The target Y-scale

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • scaleFromCenterOfObject: boolean

      Scale the transform from the center of the object (or point that is called center), not the top-left origin

    Returns void

    Deprecated

    Use addObjectScaleXTween2 and addObjectScaleYTween2 instead.

  • Tween an object scale.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toScale: number

      The target scale

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • scaleFromCenterOfObject: boolean

      Scale the transform from the center of the object (or point that is called center), not the top-left origin

    Returns void

  • Tween an object X-scale.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toScaleX: number

      The target X-scale

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • scaleFromCenterOfObject: boolean

      Scale the transform from the center of the object (or point that is called center), not the top-left origin

    Returns void

    Deprecated

    Use addObjectScaleXTween2 instead.

  • Tween an object X-scale.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toScaleX: number

      The target X-scale

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • scaleFromCenterOfObject: boolean

      Scale the transform from the center of the object (or point that is called center), not the top-left origin

    Returns void

  • Tween an object Y-scale.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toScaleY: number

      The target Y-scale

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • scaleFromCenterOfObject: boolean

      Scale the transform from the center of the object (or point that is called center), not the top-left origin

    Returns void

    Deprecated

    Use addObjectScaleYTween2 instead.

  • Tween an object Y-scale.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toScaleY: number

      The target Y-scale

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    • scaleFromCenterOfObject: boolean

      Scale the transform from the center of the object (or point that is called center), not the top-left origin

    Returns void

  • Tween an object width.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toWidth: number

      The target width

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addObjectWidthTween2 instead.

  • Tween an object width.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toWidth: number

      The target width

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Tween a text object character size.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toSize: number

      The target character size

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addTextObjectCharacterSizeTween2 instead.

  • Tween a text object character size.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • toSize: number

      The target character size

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Add an object value tween.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • fromValue: number

      Start value

    • toValue: number

      End value

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • useExponentialInterpolation: boolean

      Set it to true to use a exponential It's useful for values that are factors like a scale or a zoom.

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Add an object variable tween.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • variable: Variable

      The object variable to store the tweened value

    • fromValue: number

      Start value

    • toValue: number

      End value

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addVariableTween3 instead. This function is misleading since one could think that the tween starts right at the moment this function is called whereas the value of the variable will change at the next frame only. Moreover, the variable will not start from the start value exactly since time will have passed at the moment the next frame is rendered. See https://github.com/4ian/GDevelop/issues/4270

  • Tween an object variable.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • variable: Variable

      The object variable to store the tweened value

    • toValue: number

      End value

    • easing: string

      Easing function identifier

    • duration: number

      Duration in milliseconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

    Deprecated

    Use addVariableTween3 instead.

  • Tween an object variable.

    Parameters

    • identifier: string

      Unique id to identify the tween

    • variable: Variable

      The object variable to store the tweened value

    • toValue: number

      End value

    • easing: string

      Easing function identifier

    • duration: number

      Duration in seconds

    • destroyObjectWhenFinished: boolean

      Destroy this object when the tween ends

    Returns void

  • Reimplement this to do extra work when the behavior is created (i.e: an object using it was created), after the object is fully initialized (so you can use this.owner without risk).

    Returns void

  • This method is called when the owner of the behavior is being removed from the scene and is about to be destroyed/reused later or when the behavior is removed from an object (can happen in case of hot-reloading only. Otherwise, behaviors are just de-activated, not removed. See onDeActivate).

    Returns void

  • Called when the behavior must be updated using the specified behaviorData. This is the case during hot-reload, and is only called if the behavior was modified.

    Parameters

    • oldBehaviorData: BehaviorData

      The previous data for the behavior.

    • newBehaviorData: BehaviorData

      The new data for the behavior.

    Returns boolean

    true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).

    See

    gdjs.RuntimeBehavior#onObjectHotReloaded

  • Should return false if the behavior does not need any lifecycle function to be called. Default, hidden, "capability" behaviors set it to false. This avoids useless calls to empty lifecycle functions, which would waste CPU time (and have a sizeable impact for example when lots of static instances are living in the scene).

    Returns boolean