• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 11 years ago
  • Updated over 4 years ago

Reviews

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

Repository Details

A simple library for animating controls/values in .Net WinForm (.Net 3.5 and later). Key frame (Path) based and fully customizable.

Icon WinForm Animation Library [.Net3.5+]

A simple library for animating controls/values in .Net WinForm (.Net 3.5 and later). Key frame (Path) based and fully customizable.

Please note that even though this library designed for WinForm but its usage is not limited to WinForm and can be used in other environments. Only reference of the library is to 'System.Drawing' name space.

How to get

This library is available as a NuGet package at nuget.org.

Help me fund my own Death Star

--OR--

You can always donate your time by contributing to the project or by introducing it to others..

Documentation

  • Float2D: A class containing two float values as Vertical and Horizontal coordinates representing a point in a 2D plane.
  • Float3D: A class containing three float values as Vertical, Horizontal and Depth coordinates representing a point in a 3D plane.
  • Path: A class containing a float starting and a float ending point for a single dimensional animation as well as duration and the function to control the animation.
  • Path2D: A class containing a Float2D starting and a Float2D ending point for a two dimensional animation as well as duration and the function to control the animation.
  • Path3D: A class containing a Float3D starting and a Float3D ending point for a three dimensional animation as well as duration and the function to control the animation.
  • Animator: A class for animating an array of Path objects. This class is one of the main classes and starting points of a basic animation.
  • Animator2D: A class for animating an array of Path2D objects. This class is one of the main classes and starting points of a basic animation.
  • Animator2D: A class for animating an array of Path3D objects. This class is one of the main classes and starting points of a basic animation.
  • SafeInvoker: A class holding a reference to a function to invoke in the correct thread, detected by a Control object passed to it. Useful for easier UI manipulations.
  • SafeInvoker<T>: Same as SafeInvoker class but with a generic argument for the function to invoke.

For full documentation of the classes and their members, please take a look at our doxygen page at falahati.github.io.

Basic examples

ONE DIMENSIONAL ANIMATION OF A PROPERTY

Following code animates a property named Value of a ProgressBar named pb_progress in 5 seconds from zero to one hundred:

new Animator(new Path(0, 100, 5000))
    .Play(pb_progress, Animator.KnownProperties.Value);

TWO DIMENSIONAL ANIMATION OF A PROPERTY

Following code animates a Form in two paths. First one moves the Form from (0, -100) to (100, 200) and second path waits for 3 seconds and then moved the Form to its initial location in 2 seconds. (this is a Form)

new Animator2D(
        new Path2D(0, 100, -100, 200, 5000).ContinueTo(this.Location.ToFloat2D(), 2000, 3000))
    .Play(this, Animator2D.KnownProperties.Location);

THREE DIMENSIONAL ANIMATION OF A PROPERTY

Following code animates a property named CustomColor of a Control named c_customLabel in 2 seconds and after a delay of 1 second using the AnimationFunctions.CubicEaseIn function and with maximum of 10 frames per second.

new Animator3D(
        new Path3D(Color.Blue.ToFloat3D(), Color.Red.ToFloat3D(), 2000, 1000, AnimationFunctions.CubicEaseIn), 
        FPSLimiterKnownValues.LimitTen)
    .Play(c_customLabel, "CustomColor");

KEYFRAMES

There are extension methods for Path, Path2D, Path3D and their arrays to let you continue the path easily and define the key frames as fast as possible. For example, following code moves a Control named c_control in a rectangular path infinitely:

new Animator2D(
    new Path2D(new Float2D(100, 100), new Float2D(200, 100), 1000)
        .ContinueTo(new Float2D(200, 200), 1000)
        .ContinueTo(new Float2D(100, 200), 1000)
        .ContinueTo(new Float2D(100, 100), 1000))
{
    Repeat = true
}.Play(c_control, Animator2D.KnownProperties.Location);

CALLBACKS

It is possible to define a custom callback as frame handler as well as defining a call back to handle the end of the animation. Following example will call a method named CustomSetMethod for setting new values and handle the frames, and starts the animation in reverse path after its end for one more time:

var animator = new Animator(new Path(100, 200, 1000).ContinueTo(400, 500));
animator.Play(new SafeInvoker<float>(CustomSetMethod), new SafeInvoker(() =>
{
    animator.Paths = animator.Paths.Select(path => path.Reverse()).Reverse().ToArray();
    animator.Play(new SafeInvoker<float>(CustomSetMethod));
}));

Demo

Check the 'WinFormAnimation.Samples' project for simple usage examples. Screenshot

License

The MIT License (MIT)

Copyright (c) 2016-2020 Soroush Falahati

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

LiteDBViewer

LiteDB Viewer is a simple tool that let you open a LiteDB database file and shows its contents; think of it as a GUI for LiteDBShell
Inno Setup
290
star
2

WindowsFirewallHelper

A class library to manage the Windows Firewall as well as adding your program to the Windows Firewall Exception list.
C#
246
star
3

NvAPIWrapper

NvAPIWrapper is a .Net wrapper for NVIDIA public API, capable of managing all aspects of a display setup using NVIDIA GPUs
C#
245
star
4

CircularProgressBar

Circular ProgressBar is a custom control for WinForm with animation.
C#
244
star
5

HeliosDisplayManagement

An open source display profile management program for Windows with support for NVIDIA Surround
C#
239
star
6

NetworkAdapterSelector

A simple solution to let you force bind a program to a specific network adapter
C#
198
star
7

NiVirtualCam

OpenNI 2 Virtual Webcam - Directshow Filter
C#
124
star
8

WindowsDisplayAPI

WindowsDisplayAPI is a .Net wrapper for Windows Display and Windows CCD APIs
C#
74
star
9

UACHelper

A helper class library to detect, manage and use UAC functionalities in your program.
C#
65
star
10

NiWrapper.Net

OpenNI 2 and NiTE 2 .Net Wrapper
C#
49
star
11

PHP-MP3

PHP-MP3 is a simple library for reading and manipulating MPEG audio (MP3)
PHP
42
star
12

EDIDParser

EDIDParser is a library allowing all .Net developers to parse and to extract information from raw EDID binary data. (Extended Display Identification Data)
C#
29
star
13

NVIDIASurroundToggler

[OBSOLETE] NVidia Surround Toggler is a simple tool/program that try to fill the main gap left by NVIDIA in their surround technology's user experience by letting the user toggle between the two modes (Surround and Extended) as fast and with less pain as possible. Replaced by: https://github.com/falahati/HeliosDisplayManagement
C#
25
star
14

StartupHelper

A .Net library to add or remove your program to the startup list as well as detecting the startup session. Supporting Windows XP+ with and without administrator rights.
C#
24
star
15

veterans

"Veterans Only" (or simply "veterans") is a Plugin for SourceMod and written with SourcePawn to restrict access of players based on their playtime in a specific game
SourcePawn
16
star
16

HybridBridge

This is a PCL library that let you connect JavaScript on the browser side to the C# side by proxying C# code.
C#
12
star
17

SDroid

SDroid is a framework for designing and running custom bots for Steam network capable of trading and managing the Steam Account they are connected to.
C#
11
star
18

3DPhotoCaptureTool

OpenNI 3D Photo Capture Tool
C#
8
star
19

SharpWorker

SharpWorker is a multi-platform execution environment and helper library for scheduled, API controlled tasks. (examples: Bots, Data Miners, Web Crawlers, API Services, etc)
C#
7
star
20

ConsoleUtilities

ConsoleUtilities is a simple set of tools for creating console navigations, tables and terminals.
C#
6
star
21

SharedDLLCleanup

Cleanup any missing or specified SharedDLL entry from registry; useful for cleaning installation processes
C#
6
star
22

PyWhatsAppWeb

WhatsApp web client automation using selenium in Python
Python
5
star
23

PCIIdentificationResolver

PCI Identification Resolver is a library containing the list of known PCI vendors, devices and other related information for .Net
C#
4
star
24

DownloadHelper

C#
2
star
25

warmupDM

Warmup DeathMatch (warmupDM) is a Plugin for the Valve's FPS game server, Counter Strike: Global Offensive Dedicated Server using SourceMod and written with SourcePawn
SourcePawn
1
star
26

Bitfinex.Net

C#
1
star
27

EnkompassDBackupConverter

Simple command line tool to extract the database script from an enkompass backup file
C#
1
star
28

AnagramFinder

This is a NetStandard C# answer to the TrustPilot's Rabbit Hole Challenge
C#
1
star
29

AdvancedServiceWorker

A customizable and dynamic, yet simple service worker for your website
TypeScript
1
star