https://github.com/aloisdeniel/Transform
Base Monogame objects for managing relative transforms.
https://github.com/aloisdeniel/Transform
matrix monogame transform
Last synced: 4 months ago
JSON representation
Base Monogame objects for managing relative transforms.
- Host: GitHub
- URL: https://github.com/aloisdeniel/Transform
- Owner: dotnet-ad
- License: mit
- Created: 2017-10-14T15:42:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-17T15:21:59.000Z (almost 6 years ago)
- Last Synced: 2024-08-10T11:01:21.153Z (10 months ago)
- Topics: matrix, monogame, transform
- Language: C#
- Homepage:
- Size: 389 KB
- Stars: 23
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-monogame - Transform -  - Base objects for managing relative transforms. (Helpers)
README
# Transform
[](https://www.nuget.org/packages/Transform/) [](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ZJZKXPPGBKKAY&lc=US&item_name=GitHub&item_number=0000001¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)

Base Monogame objects for managing relative transforms.
## Quickstart
```csharp
// 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](http://aloisdeniel.github.io)