• Stars
    star
    270
  • Rank 152,189 (Top 3 %)
  • Language
    C#
  • License
    MIT License
  • Created about 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easily add fade, slide and zoom-effects into your Blazor applications.

Now part of Blazorise

Starting from the 2020/12/1, Blazor.Animate is now proud to be part of the Blazorise: https://github.com/stsrki/Blazorise. All the updates and future work for Blazor.Animate will continue through Blazorise.

Blazor.Animate

Easily add fade, slide and zoom-effects into your Blazor applications. Blazor.Animate is powered by the excellent AOS-library.

Blazor.Animate animation

Blazor.Animate is an animation component for Blazor. With Blazor.Animate you can animate how other components are brought to the view. You can easily add fade, slide and zoom-effects and even add easing to the animations.

NuGet

Quick Start

To animate a component, wrap it inside Animate-component and use the Animation-parameter to define the animation:

    <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(0.5)" >
        <Counter></Counter>
    </Animate>

Getting Started

Few steps are required in order to use the library.

Add NuGet

Install-Package BlazorAnimate

Configure _Imports.razor

...
@using BlazorAnimate

Add JS interop into _Host.cshtml

    <script src="_content/BlazorAnimate/blazorAnimateInterop.js"></script>

Use the Animate-component

    <Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(0.5)" Delay="TimeSpan.FromSeconds(1)">
        <Counter></Counter>
    </Animate>

Sample

For a sample, please view http://animateblazorsamplessvc.azurewebsites.net/

The sample's source code is available from GitHub: https://github.com/mikoskinen/Blazor.Animate/tree/master/samples/BlazorAnimate.Sample

Running animation manually

It's possible to run the animation manually. Please note that the animated component will be hidden until the animation is manually executed.

To animate component manually, first set the IsManual to true and also capture the reference to the component:

	<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(0.5)" @ref="myAnim" IsManual="true">
		<Counter></Counter>
	</Animate>

Then in code-behind, call Run-method to animate the component:

	@code {

		private Animate myAnim;

		private void RunAnimation()
		{
			myAnim.Run();
		}
	}

The Manual.razor page in the sample illustrates this functionality.

Animations

To define an animation, use the Animation-property of the Animate-component. The built-in animations are available from BlazorAnimate.Animations:

  • Fade
  • FadeIn
  • FadeUp
  • FadeDown
  • FadeLeft
  • FadeRight
  • FadeUpRight
  • FadeUpLeft
  • FadeDownRight
  • FadeDownLeft
  • FlipUp
  • FlipDown
  • FlipLeft
  • FlipRight
  • SlideUp
  • SlideDown
  • SlideLeft
  • SlideRight
  • ZoomIn
  • ZoomInUp
  • ZoomInDown
  • ZoomInLeft
  • ZoomInRight
  • ZoomOut
  • ZoomOutUp
  • ZoomOutDown
  • ZoomOutLeft
  • ZoomOutRight

Use Duration (TimeSpan) or DurationMs -property to define the duration of an animation.

Use Delay (TimeSpan) or DelayMs -property to define how long the animation is delayed before it is started.

Available easings

To define an easing for the animation, use the Easing-property of the Animate-component. The built-in easings are available from BlazorAnimate.Easings:

  • Linear
  • Ease
  • EaseIn
  • EaseOut
  • EaseInOut
  • EaseInBack
  • EaseOutBack
  • EaseInOutBack
  • EaseInSine
  • EaseOutSine
  • EaseInOutSine
  • EaseInQuad
  • EaseOutQuad
  • EaseInOutQuad
  • EaseInCubic
  • EaseOutCubic
  • EaseInOutCubic
  • EaseInQuart
  • EaseOutQuart
  • EaseInOutQuart

Configuring the defaults

ASP.NET Core's options can be used to define the default animation settings:

            services.Configure<AnimateOptions>(options =>
            {
                options.Animation = Animations.FadeDown;
                options.Duration = TimeSpan.FromMilliseconds(100);
            });

If no animation parameters is defined on the Animate-component, the defaults are used:

<Animate>
    <h1>Hello, world!</h1>
</Animate>

Named configurations

Blazor.Animate supports named animation settings through the ASP.NET Core's named options. Here's an example where two configurations are provided, one without a name (the defaults) and one with a name:

            services.Configure<AnimateOptions>("my", options =>
            {
                options.Animation = Animations.FadeDown;
                options.Duration = TimeSpan.FromSeconds(2);
            });

            services.Configure<AnimateOptions>(options =>
            {
                options.Animation = Animations.FadeDown;
                options.Duration = TimeSpan.FromMilliseconds(100);
            });

To use a named configuration, provide the OptionsName-parameter:

<Animate OptionsName="my">
    <h1>Hello, world!</h1>
</Animate>

Authors

Blazor.Animate is created by Mikael Koskinen.

Contributions are welcome!

License

Blazor.Animate is MIT licensed. The library uses the following other libraries:

  • AOS: MIT-license

More Repositories

1

graze

Static site generator using Razor.
C#
151
star
2

Blazor.EventAggregator

Lightweight Event Aggregator for Blazor (Razor Components).
C#
117
star
3

blog

Source codes from my blog posts
C#
53
star
4

Blazor.AdaptiveCards

Adaptive Cards for Blazor
C#
49
star
5

SQLLint

SQLLint is a web based reformatter and beautifier for SQL.
CSS
40
star
6

socketex

TcpClient for Windows Phone
C#
16
star
7

GrazeDocs

Static site generator for creating documentation for your projects
C#
15
star
8

Blazor.Page

Page base component for Blazor pages. Easily update page title and optionally inject datacontext into your page.
C#
9
star
9

vssbindingremover

VSS Binding Remover strips out the Visual Source Safe related sections from the Visual Studio solution and project files
C#
9
star
10

NSQLFormatter-dotnet

Beautify your SQL easily. NSQLFormatter is an open-source SQL Beautifier written with C# and .NET Framework 4.0. Project is based 100% on the work done in the NHibernate-project.
C#
9
star
11

grazewp7

Windows Phone 7 app marketing web site Generator using Graze and Twitter Bootstrapper.
JavaScript
8
star
12

UWPResponsiveXAMLLayoutGridAdaptiveTrigger

Example of how to use repositioning to create a responsive layout for your XAML Universal Windows app (UWP) using Grid and AdaptiveTrigger.
C#
7
star
13

UWP.MDI

Multiple document interface (MDI) support for UWP applications
C#
7
star
14

ircbot-dotnet

Irc bot built with easy extensibility in mind. Written with C#, the bot provides a platform on which to add new features and functionality easily.
C#
7
star
15

Caliburn-Micro-WinRT-Callisto-Helpers

Helper classes for showing Callisto dialogs with Caliburn.Micro
C#
4
star
16

AttachToDotnet

Extension for Visual Studio 2017/2019 which makes it easier to attach to the correct dotnet.exe process
C#
4
star
17

SubtitleProvider

Subtitle plugin for MediaBrowser. The plugin adds an automatic subtitle downloading to MediaBrowser.
C#
4
star
18

node-web-api-benchmark

Codes for the Node.js vs ASP.NET Web Api benchmarks
C#
4
star
19

irc7

The Windows Phone IRC chat app
3
star
20

AzureBlobBridgeIFTTT

Azure Blob Bridge for IFTTT provides an easy way to use Azure Blob storage as a IFTTT Action.
C#
3
star
21

OcelotIdentityServerAzureAdWithApi

Demo for a scenario where API is accessed through Ocelot gateway and Ocelot uses IdentityServer and Azure Ad for authentication
C#
3
star
22

wordpress-sql-azure

Wordpress with SQL Azure
PHP
2
star
23

NXMLFormatter

NXMLFormatter is an open-source XML Beautifier written with C#.
C#
2
star
24

NCompileBench

Compilation benchmark for Windows. How fast can your computer compile .NET code?
C#
2
star
25

softwaremkwebsource

www.softwaremk.org
CSS
1
star
26

websitetest

1
star
27

grazeblog

Blog platform based on Graze templating engine.
1
star
28

UWPEventAggregator

Simple event aggregator for Multi Window UWP apps
C#
1
star
29

uwpusercontrollistdp

C#
1
star
30

durandal-phonegap-windows-phone-sample

A sample which shows how to use Durandal in a PhoneGap based Windows Phone app.
JavaScript
1
star
31

ipsnoop

The website for IP Snoop app for Windows Phone 7
1
star
32

link

Standalone host for the ASP.NET Web Api
1
star
33

ampparit

Ampparit.com Reader website
1
star
34

UWP-SemanticZoom-GridView

Sample UWP app which shows how to use SemanticZoom with GridView
C#
1
star
35

uwpusercontrolbinding

C#
1
star
36

softwaremkassets

JavaScript
1
star
37

softwaremkwebsite

www.softwaremk.org
JavaScript
1
star
38

marketwatcher

Windows Phone class library which fetches reviews for a desired app from the Windows Marketplace.
C#
1
star
39

aurelia-uwp

Sample of creating an Aurelia-based UWP app
JavaScript
1
star
40

movieposters

Website for Movie Poster for Windows Phone 7
1
star