UltravioletFramework / ultraviolet

The Ultraviolet Framework is a .NET game development framework written in C#.
https://github.com/UltravioletFramework/ultraviolet/wiki
MIT License
541 stars 46 forks source link

Effect (Transform) for Sprite #119

Closed kinosang closed 4 years ago

kinosang commented 4 years ago

How can I do matrix transform for a sprite (bitmap), for e.g., alpha (fade-in, fade-out), spinning (like Sample4), etc

kinosang commented 4 years ago

asked via Gitter.

kinosang commented 4 years ago

Finally, I found some useful functions

public void Draw(
    Texture2D texture,
    Vector2 position,
    Nullable<Rectangle> sourceRectangle,
    Color color,
    float rotation,
    Vector2 origin,
    Vector2 scale,
    SpriteEffects effects,
    float layerDepth
)

http://uv.twistedlogik.net/ultraviolet/reference/latest/html/M_Ultraviolet_Graphics_Graphics2D_SpriteBatchBase_2_Draw_9.htm

public void DrawSprite(
    SpriteAnimationController animation,
    Vector2 position,
    Nullable<float> width,
    Nullable<float> height,
    Color color,
    float rotation,
    SpriteEffects effects,
    float layerDepth
)

http://uv.twistedlogik.net/ultraviolet/reference/latest/html/M_Ultraviolet_Graphics_Graphics2D_SpriteBatchBase_2_DrawSprite_7.htm