LumexUI.Motion 0.0.4

dotnet add package LumexUI.Motion --version 0.0.4
                    
NuGet\Install-Package LumexUI.Motion -Version 0.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LumexUI.Motion" Version="0.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LumexUI.Motion" Version="0.0.4" />
                    
Directory.Packages.props
<PackageReference Include="LumexUI.Motion" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LumexUI.Motion --version 0.0.4
                    
#r "nuget: LumexUI.Motion, 0.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=LumexUI.Motion&version=0.0.4
                    
Install as a Cake Addin
#tool nuget:?package=LumexUI.Motion&version=0.0.4
                    
Install as a Cake Tool

🚧 Notice 🚧

This project is in a very raw and experimental state. It is not production-ready and may contain bugs, missing features, and breaking changes as development progresses.

This project was primarily created to support the main LumexUI project, and functionality is added only as needed to fulfill its requirements. As a result, it may lack certain features or general-purpose usability.

If you choose to explore or contribute, please be aware that stability is not guaranteed, and updates may be infrequent or focused on specific needs.

API

Since this project is a Blazor wrapper, I mimic the original API, but it’s not fully implemented yet. For more details, refer to the original Motion React documentation.

public record MotionProps
{
    // Animations that are triggered on after render.
    public object? Enter { get; init; }

    // Animations that are triggered before component is removed from the render tree.
    public object? Exit { get; init; }

    // Transition settings for all animations.
    public object? Transition { get; init; }
};

The properties are of type object purely for simplicity, as they are later serialized into JavaScript objects. Additionally, this makes it easier to follow the Motion's usage examples.

Examples

The Motion library is one of the most powerful animation libraries available, allowing you to create almost any animation you want. Check out the full list of Motion vanilla JavaScript examples here.

Below are some of the simplest animation examples to give you an idea of how it works in this library.

Simple Fade-In Animation
@* A component that wraps content for animation. *@
<Motion Enter="@_motionProps.Enter">
    <h1>Hello, world!</h1>
</Motion>

@code {
    private MotionProps _motionProps = new MotionProps
    {
        Enter = new
        {
            Opacity = new float[] { 0, 1 } // Animate opacity from 0 to 1.
        }
    };
}

https://github.com/user-attachments/assets/7b86932e-7e5c-422e-959d-a091f11ee4ef

Simple Fade-Out Animation
<button @onclick="@(() => _isVisible = !_isVisible)">
    @(_isVisible ? "Hide" : "Show")
</button>

@* A component that detects when its direct children are removed from the render tree. *@
<AnimatePresence>
    @if( _isVisible )

https://github.com/user-attachments/assets/f15b1484-ce17-469f-800d-c5c6dbe32e2a


    {
        <Motion Exit="@_motionProps.Exit">
            <h1>Hello, world!</h1>
        </Motion>
    }
</AnimatePresence>

@code {
    private bool _isVisible = false;

    private MotionProps _motionProps = new MotionProps
    {
        Exit = new
        {
            Opacity = 0 // Animate opacity from initial (1) to 0.
        }
    };
}

https://github.com/user-attachments/assets/ee0139fb-0e83-45b4-a095-907c0b2947c8

Simple Fade-In-Out Animation
<button @onclick="@(() => _isVisible = !_isVisible)">
    @(_isVisible ? "Hide" : "Show")
</button>

<AnimatePresence>
    @if( _isVisible )
    {
        <Motion Enter="@_motionProps.Enter" Exit="@_motionProps.Exit">
            <h1>Hello, world!</h1>
        </Motion>
    }
</AnimatePresence>

@code {
    private bool _isVisible = false;

    private MotionProps _motionProps = new MotionProps
    {
        Enter = new
        {
            Opacity = new float[] { 0, 1 } // Animate opacity from 0 to 1.
        },

        Exit = new
        {
            Opacity = 0 // Animate opacity from current (1) to 0.
        }
    };
}

https://github.com/user-attachments/assets/e98c272d-977e-4ad9-b919-630db6d84016

Ultimately, the component is actually removed from the DOM.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LumexUI.Motion:

Package Downloads
LumexUI

🚀 A versatile Blazor UI library built using Tailwind CSS.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on LumexUI.Motion:

Repository Stars
LumexUI/lumexui
🚀 A versatile Blazor UI library built using Tailwind CSS.
Version Downloads Last Updated
0.0.4 979 2/22/2025
0.0.3 112 2/22/2025
0.0.2 116 2/22/2025