Giter Site home page Giter Site logo

jorik041 / xamarin.forms.animationspack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from takecx/xamarin.forms.animationspack

0.0 0.0 0.0 395 KB

Visual Element Animation library for Xamarin.Forms. BackgroundColor,Opacity,Margin,FontSize,CornerRadius and so on.

Home Page: https://www.nuget.org/packages/Xamarin.Forms.AnimationsPack/

License: MIT License

C# 100.00%

xamarin.forms.animationspack's Introduction

Xamarin.Forms.AnimationsPack

Xamarin.Forms.AnimationsPack is Animation library for Xamarin.Forms. This library contains Animations.

How to Install

Install from NuGet.

> Install-Package Xamarin.Forms.AnimationsPack

https://www.nuget.org/packages/Xamarin.Forms.AnimationsPack

Demo Project

Demo project applying this library is located to the following path of this repository.

demo/XFAnimationDemo.sln

Let's build and run demo application!

How to Use

Namespace Declaration

xmlns:animationsPack="clr-namespace:Xamarin.Forms.AnimationsPack;assembly=Xamarin.Forms.AnimationsPack"

Apply Animation

EventTrigger

Simple code sample for Xamrin.Forms.Entry control.

<Entry Text="Welcome to Xamarin.Forms!" TextColor="Black" FontSize="20" BackgroundColor="Gray">
  <Entry.Triggers>
    <EventTrigger Event="Focused">
      <animationsPack:EntryTextColorAnimation From="Black" To="Lime" Length="1000" Easing="Linear"/>
      <animationsPack:EntryFontSizeDoubleAnimation To="30" Length="3000"/>
      <animationsPack:BackgroundColorAnimation To="Teal" Easing="CubicInOut"/>
    </EventTrigger>
  </Entry.Triggers>
</Entry>

This example shows following animation.

  • Animation starts when Entry is focused.
    • TextColor property : Black > Lime, 1000 millisecond, Linear easing-function
    • FontSize property : 20 > 30, 3000 millisecond, Linear easing-function
    • BackgroundColor property : Gray > Teal, 1000 millisecond, CubicInOut easing-function

DataTrigger

In the DataTrigger sample, we assume that BindingContext is already set, and that ViewModel contains bool type property named IsAnimationWorking.

<Button Command="{Binding RunAnimation}" Text="RunAnimation"/>
<Entry Text="Welcome to Xamarin.Forms!" TextColor="Black" FontSize="20" BackgroundColor="Gray" VerticalOptions="FillAndExpand">
  <Entry.Triggers>
    <DataTrigger TargetType="Entry" Binding="{Binding Path=IsAnimationWorking,Mode=OneWay,UpdateSourceEventName=PropertyChanged}" Value="true">
      <DataTrigger.EnterActions>
        <animationsPack:EntryTextColorAnimation From="Black" To="Yellow" Length="1000" Easing="BounceIn"/>
        <animationsPack:EntryFontSizeDoubleAnimation To="50" Length="2000"/>
        <animationsPack:BackgroundColorAnimation To="Red" Easing="SinIn"/>
      </DataTrigger.EnterActions>
      <DataTrigger.ExitActions>
        <animationsPack:EntryTextColorAnimation To="Black"/>
        <animationsPack:EntryFontSizeDoubleAnimation To="20"/>
        <animationsPack:BackgroundColorAnimation To="Gray"/>
      </DataTrigger.ExitActions>
    </DataTrigger>
  </Entry.Triggers>
</Entry>

This example shows following animation.

  • Animation starts when Button is clicked (IsAnimationWorking is set to true when Button is clicked).
    • TextColor property : Black > Yellow, 1000 millisecond, BounceIn easing-function
    • FontSize property : 20 > 50, 2000 millisecond, Linear easing-function
    • BackgroundColor property : Gray > Red, 1000 millisecond, SinIn easing-function
  • After 2 seconds, another animation starts (IsAnimationWorking is force change to false after 2 seconds).
    • TextColor property : Yellow > Black, 1000 milliseconds, Linear easing-function
    • FontSize property : 50 > 20, 1000 milliseconds, Linear easing-function
    • BackgroundColor property : Red > Gray, 1000 milliseconds, Linear easing-function

Note : (Bold Property) is explicitly specified property. (Italic property) is unspecified and apply to default-value property

Dependencies

Xamarin.Forms : 3.2.0.871581

Common Property

public T From { get; set; } = default(T); // Animation starting value
public T To { get; set; } = default(T); // Animation ending value
public uint Length { get; set; } = 1000; // Animation Length (milliseconds)
public string Easing { get; set; } = "Linear"; // Animation EasingFunction name

Animation List

Property Owner Property Animation Class Name T Implemented
VisualElement BackgroundColor BackgroundColorAnimation Color
Opacity OpacityDoubleAnimation double
HeightRequest HeightRequestDoubleAnimation double
WidthRequest WidthRequestDoubleAnimation double
Rotation (RotationTo) double -
Scale (ScaleTo) double -
View Margin MarginThicknessAnimation Thickness
Label FontSize LabelFontSizeDoubleAnimation double
TextColor LabelTextColorAnimation Color
LineHeight LabelLineHeightDoubleAnimation double
ActivityIndicator Color ActivityIndicatorColorAnimation Color
BoxView Color BoxViewColorAnimation Color
CornerRadius BoxViewCornerRadiusAnimation CornerRadius
Button BorderColor ButtonBorderColorAnimation Color
BorderWidth ButtonBorderWidthDoubleAnimation double
CornerRadius ButtonCornerRadiusAnimation CornerRadius
FontSize ButtonFontSizeDoubleAnimation double
Padding ButtonPaddingThicknessAnimation Thickness
TextColor ButtonTextColorAnimation Color
DatePicker FontSize DatePickerFontSizeDoubleAnimation double
TextColor DatePickerTextColorAnimation Color
Layout Padding LayoutPaddingThicknessAnimation Thickness
AbsoluteLayout LayoutBounds AbsoluteLayoutBoundsRectangleAnimation Rectangle ?
Grid ColumnSpacing GridColumnSpacingDoubleAnimation double
RowSpacing GridRowSpacingDoubleAnimation double
StackLayout Spacing StackLayoutSpacingDoubleAnimation double
Picker TextColor PickerTextColorAnimation Color
FontSize PickerFontSizeDoubleAnimation double
ProgressBar ProgressColor ProgressBarColorAnimation Color
Slider MaximumTrackColor SliderMaximumTrackColorAnimation Color
MinimumTrackColor SliderMinimumTrackColorAnimation Color
ThumbColor SliderThumbColorAnimation Color
Switch OnColor SwitchOnColorAnimation Color
TableView RowHeight TableViewRowHeightIntAnimation int
TimePicker FontSize TimePickerFontSizeDoubleAnimation double
TextColor TimePickerTextColorAnimation Color
Editor FontSize EditorFontSizeDoubleAnimation double
PlaceholderColor EditorPlaceholderColorAnimation Color
TextColor EditorTextColorAnimation Color
Entry FontSize EntryFontSizeDoubleAnimation double
PlaceholderColor EntryPlaceholderColorAnimation Color
TextColor EntryTextColorAnimation Color
ListView RowHeight ListViewRowHeightDoubleAnimation double
SeparatorColor ListViewSeparatorColorAnimation Color
Frame BorderColor FrameBorderColorAnimation Color
CornerRadius FrameCornerRadiusAnimation CornerRadius
OutlineColor(Obsolete) FrameOutlineColorAnimation Color

Xamarin.Forms namespace Class Diagram

https://drive.google.com/file/d/1cYChmthboGXX__Rg5pFC1O2pTNE7vWGy/view?usp=sharing

xamarin.forms.animationspack's People

Contributors

takecx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.