Skip to content
Eduard Gushchin edited this page Jun 21, 2026 · 5 revisions

Node2D

Back to API Reference

Namespace: Electron2D

Summary

Provides the Electron2D 2D transform node used by sprites and future 2D nodes.

Declaration

public class Electron2D.Node2D : Electron2D.CanvasItem

Remarks

Node2D combines position, rotation and scale into a local Electron2D.Transform2D. A direct Node2D parent contributes to Electron2D.Node2D.GlobalTransform; a non-Node2D parent breaks the transform chain for the 0.1.0 Preview subset.

Thread Safety

This type is not synchronized. Create and mutate nodes on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CanvasItem

Members

Member Kind Summary
GlobalPosition Property Gets or sets the global 2D position.
GlobalRotation Property Gets or sets the global rotation in radians.
GlobalRotationDegrees Property Gets or sets the global rotation in degrees.
GlobalScale Property Gets or sets the global 2D scale.
GlobalTransform Property Gets or sets the transform relative to the global 2D canvas.
Position Property Gets or sets the local position relative to the direct Node2D parent.
Rotation Property Gets or sets the local rotation in radians.
RotationDegrees Property Gets or sets the local rotation in degrees.
Scale Property Gets or sets the local 2D scale.
Transform Property Gets or sets the local transform built from position, rotation and scale.
Electron2D.Node2D() Constructor Initializes a new instance of the Node2D type.
ApplyScale(Electron2D.Vector2) Method Multiplies the current local scale by a ratio.
GlobalTranslate(Electron2D.Vector2) Method Translates the node in global coordinates.
Rotate(System.Single) Method Adds a rotation in radians to the local transform.
ToGlobal(Electron2D.Vector2) Method Transforms a local point into global coordinates.
ToLocal(Electron2D.Vector2) Method Transforms a global point into this node's local coordinates.
Translate(Electron2D.Vector2) Method Translates the node in local coordinates.

Member Details

GlobalPosition

Kind: Property

public Electron2D.Vector2 GlobalPosition { get; set; }

Summary

Gets or sets the global 2D position.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current global position value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

GlobalRotation

Kind: Property

public System.Single GlobalRotation { get; set; }

Summary

Gets or sets the global rotation in radians.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current global rotation value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

GlobalRotationDegrees

Kind: Property

public System.Single GlobalRotationDegrees { get; set; }

Summary

Gets or sets the global rotation in degrees.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current global rotation degrees value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D.GlobalRotation

GlobalScale

Kind: Property

public Electron2D.Vector2 GlobalScale { get; set; }

Summary

Gets or sets the global 2D scale.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current global scale value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

GlobalTransform

Kind: Property

public Electron2D.Transform2D GlobalTransform { get; set; }

Summary

Gets or sets the transform relative to the global 2D canvas.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current global transform value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D.Transform

Position

Kind: Property

public Electron2D.Vector2 Position { get; set; }

Summary

Gets or sets the local position relative to the direct Node2D parent.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current position value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

Rotation

Kind: Property

public System.Single Rotation { get; set; }

Summary

Gets or sets the local rotation in radians.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current rotation value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D.RotationDegrees

RotationDegrees

Kind: Property

public System.Single RotationDegrees { get; set; }

Summary

Gets or sets the local rotation in degrees.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current rotation degrees value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D.Rotation

Scale

Kind: Property

public Electron2D.Vector2 Scale { get; set; }

Summary

Gets or sets the local 2D scale.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current scale value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

Transform

Kind: Property

public Electron2D.Transform2D Transform { get; set; }

Summary

Gets or sets the local transform built from position, rotation and scale.

Remarks

The setter decomposes position, rotation and scale for transforms without skew. Skew is outside the Electron2D 0.1.0 Preview subset.

Value

The current transform value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

Electron2D.Node2D()

Kind: Constructor

public Electron2D.Node2D()

Summary

Initializes a new instance of the Node2D type.

Remarks

The new instance follows the lifetime and validation rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

ApplyScale(Electron2D.Vector2)

Kind: Method

public System.Void ApplyScale(Electron2D.Vector2)(Electron2D.Vector2 ratio)

Summary

Multiplies the current local scale by a ratio.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • ratio: The X and Y scale ratio to multiply into Electron2D.Node2D.Scale.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

GlobalTranslate(Electron2D.Vector2)

Kind: Method

public System.Void GlobalTranslate(Electron2D.Vector2)(Electron2D.Vector2 offset)

Summary

Translates the node in global coordinates.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • offset: The global offset to add to Electron2D.Node2D.GlobalPosition.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

Rotate(System.Single)

Kind: Method

public System.Void Rotate(System.Single)(System.Single radians)

Summary

Adds a rotation in radians to the local transform.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • radians: The angle in radians to add to Electron2D.Node2D.Rotation.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

ToGlobal(Electron2D.Vector2)

Kind: Method

public Electron2D.Vector2 ToGlobal(Electron2D.Vector2)(Electron2D.Vector2 localPoint)

Summary

Transforms a local point into global coordinates.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • localPoint: The point in this node's local coordinate space.

Returns

The transformed point in global coordinate space.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D.ToLocal(Electron2D.Vector2)

ToLocal(Electron2D.Vector2)

Kind: Method

public Electron2D.Vector2 ToLocal(Electron2D.Vector2)(Electron2D.Vector2 globalPoint)

Summary

Transforms a global point into this node's local coordinates.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • globalPoint: The point in global coordinate space.

Returns

The transformed point in this node's local coordinate space.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D.ToGlobal(Electron2D.Vector2)

Translate(Electron2D.Vector2)

Kind: Method

public System.Void Translate(Electron2D.Vector2)(Electron2D.Vector2 offset)

Summary

Translates the node in local coordinates.

Remarks

This is equivalent to Position += offset.

Parameters

  • offset: The local offset to add to Electron2D.Node2D.Position.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node2D

Clone this wiki locally