Skip to content

dotnet-ad/Transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transform

NuGet Donate

sample

Base Monogame objects for managing relative transforms.

Quickstart

// Hierarchy
this.arm.Transform.Position = new Vector2(this.GraphicsDevice.Viewport.Width / 2, this.GraphicsDevice.Viewport.Height / 2);

this.arm2.Transform.Position = new Vector2(this.arm.Length, 0);
this.arm2.Transform.Parent = this.arm.Transform;

this.arm3.Transform.Position = new Vector2(this.arm2.Length, 0);
this.arm3.Transform.Parent = this.arm2.Transform;

// Animation
this.tween = new Tween2D(TimeSpan.FromSeconds(5), this.arm.Transform, new Transform2D()
{
    Rotation = 5,
    Position = this.arm.Transform.Position,
    Scale = new Vector2(2,2),
}, Ease.ElasticInOut);

this.velocity2 = new Velocity2D(arm2.Transform)
{
    Rotation = 2f,
    Position = Vector2.UnitX * -2f,
};

this.velocity3 = new Velocity2D(arm3.Transform)
{
    Rotation = -3.5f,
};

Usage

Transform2D

Represents a 2 dimensions transformation. A transform could be attached to another transform by setting its Parent property. The relative Position, Scale, Rotation could be used to update each component of the transform (relative to the parent transform if set, else absolute position). The effective absolute output world components can be accessed through AbsolutePosition, AbsoluteScale, AbsoluteRotation.

Velocity2D

Represents a transform linear velocity following Position, Scale, Rotation independant components.

Acceleration2D

Represents a velocity linear acceleration following Position, Scale, Rotation independant components.

ITween

Represents an animation.

Tween2D

Tweens a value between two given transform, in a given amount of time, and with a given curve function.

Sequence

Chains several ITween to create complex animations.

Parallel

Runs a given set of ITween in parallel until all are finished.

Delay

Waits the given amount of time.

Contributions

Contributions are welcome! If you find a bug please report it and if you want a feature please report it.

If you want to contribute code please file an issue and create a branch off of the current dev branch and file a pull request.

License

MIT © Aloïs Deniel

About

Base Monogame objects for managing relative transforms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published