Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter flutter logo animator

enables you to create stunning flutter animations, faster, efficient and with less code.

partly inspired by the amazing animate.css package by dan eden. please note, although it’s inspired by animate.css, this still is a flutter package, meaning it will be available for all flutter-supported platforms.

  • lightspeedin
  • lightspeedout

getting started

note: to see all of the animated widgets in action be sure to run the app in the demo_app package, or view them on the animate.css page.

put the dependency inside your pubspec.yml and run packages get.

using one of the animate.css style widgets:

import 'package:flutter/widgets.dart';
import 'package:animator/animator.dart';

class testanimatedwidget extends statelesswidget {
  @override
  widget build(buildcontext context) {
    return rubberband(
      child: text(
        'rubber',
        style: textstyle(fontsize: 20),
      ),
    );
  }
}

using a globalkey to enable play/stop/reverse animations from code:

import 'package:flutter/widgets.dart';
import 'package:animator/animator.dart';

class testanimatedwidget extends statefulwidget {
  @override
  _testanimatedwidgetstate createstate() => _testanimatedwidgetstate();
}
class _testanimatedwidgetstate extends state<testanimatedwidget> {
  //register a key in your state:
  globalkey<animatorwidgetstate> _key = globalkey<animatorwidgetstate>();
  
  @override
  widget build(buildcontext context) {
    return column(
      children: <widget>[
        expanded(
            //render the widget using the _key
            child: rubberband(
              key: _key,
              child: text(
                'rubber',
                style: textstyle(fontsize: 60),
              ),
            ),
        ),
        padding(
            padding: edgeinsets.fromltrb(10, 10, 10, 30),
            child: iconbutton(
              icon: icon(
                icons.play_arrow,
                color: colors.green,
              ),
              //use _key.currentstate to forward/stop/reverse
              onpressed: () => _key.currentstate.forward(),
            ),
        ),
      ],
    );
  }
}

create your own:

below is the code (with extra comments) from the actual fadeindown animated widget.
it should give you a clear insight on how to animate with the animator using the animatorwidget.

import 'package:flutter/widgets.dart';

import '../../flutter_animator.dart';

///firstly, we create an _animationdefinition_.
///this is the actual animation part, which gets driven by the _animatorwidget_.
class fadeindownanimation extends animationdefinition {
  fadeindownanimation({
  ///[animationpreferences] allows us to use the animation with different parameters for:
  ///offset, duration, autoplay and an animationstatuslistener.
    animationpreferences preferences = const animationpreferences(),
  }) : super(
          preferences: preferences,
          ///if you want to use the size of the widget, you need to define it here. (needsscreensize is also available)
          needswidgetsize: true,
          ///the opacity to use on the first render when using screensize or widgetsize.
          ///in some cases 'flickering' may appear when this isn't set to 1.0 or 0.0 respectively.
          prerenderopacity: 0.0,
        );

  ///use the build function to actually render the animated values.
  ///performance-wise it's better to use a fadetransition for opacity animation.
  ///use animatedbuilder to update te animation and it's values.
  @override
  widget build(buildcontext context, animator animator, widget child) {
    return fadetransition(
      ///use animator.get([key]) to get to the animation object.
      opacity: animator.get("opacity"),
      child: animatedbuilder(
        ///[animator] exposes the animationcontroller via animator.controller.
        animation: animator.controller,
        child: child,
        builder: (buildcontext context, widget child) => transform.translate(
          child: child,
          ///use animator.get([key]).value to get the animated value.
          offset: offset(0.0, animator.get("translatey").value),
        ),
      ),
    );
  }

  ///inside the getdefinition method we return the actual animation.
  @override
  map<string, tweenlist> getdefinition({size screensize, size widgetsize}) {
    return {
      ///define a [key] and a list of animated values from 0 to 100 percent.
      ///please not that you can also define an animation curve inside the [tweenpercentage] class:
      ///tweenpercentage(percent: 0, value: 0.0, curve: curves.ease),
      "opacity": tweenlist<double>(
        [
          tweenpercentage(percent: 0, value: 0.0),
          tweenpercentage(percent: 100, value: 1.0),
        ],
      ),
      "translatey": tweenlist<double>(
        [
          tweenpercentage(percent: 0, value: -widgetsize.height),
          tweenpercentage(percent: 100, value: 0.0),
        ],
      ),
    };
  }
}

///to use the animationdefinition we just created we could do the following:
///for a single animation:
/// animatorwidget(child: [child], definition: fadeindownanimation());
/// 
///for in & out animations:
///  inoutanimation(child: [child), indefinition: fadeindownanimation(), outdefinition: ...);
/// 

available default animations:

attention seekers

animator - stunning animations
animations – attention seekers
  • bounce
  • flash
  • headshake
  • heartbeat
  • jello
  • pulse
  • rubberband
  • shake
  • swing
  • tada
  • wobble

bouncing entrances

bouncing_entrances
animations – bouncing entrances
  • bouncein
  • bounceindown
  • bounceinleft
  • bounceinright
  • bounceinup

bouncing exits

bouncing_exits
animations – bouncing exits
  • bounceout
  • bounceoutdown
  • bounceoutleft
  • bounceoutright
  • bounceoutup

fading entrances

fading_entrances
animations – fading entrances
  • fadein
  • fadeindown
  • fadeindownbig
  • fadeinleft
  • fadeinleftbig
  • fadeinright
  • fadeinrightbig
  • fadeinup
  • fadeinupbig

fading exits

fading_exits
animations – fading exits
  • fadeout
  • fadeoutdown
  • fadeoutdownbig
  • fadeoutleft
  • fadeoutleftbig
  • fadeoutright
  • fadeoutrightbig
  • fadeoutup
  • fadeoutupbig

flippers

flippers
animations – flippers
  • flip
  • flipinx
  • flipiny
  • flipoutx
  • flipouty

lightspeed

light_speed
animations – lightspeed
  • lightspeedin
  • lightspeedout

rotating entrances

rotating_entrances
animations – rotating entrances
  • rotatein
  • rotateindownleft
  • rotateindownright
  • rotateinupleft
  • rotateinupright

rotating exits

rotating_exits
rotating exits
  • rotateout
  • rotateoutdownleft
  • rotateoutdownright
  • rotateoutupleft
  • rotateoutupright

sliding entrances

sliding_entrances
sliding entrances
  • slideindown
  • slideinleft
  • slideinright
  • slideinup

sliding exits

sliding_exits
sliding exits
  • slideoutdown
  • slideoutleft
  • slideoutright
  • slideoutup

specials

specials
specials
  • hinge
  • jackinthebox
  • rollin
  • rollout

zooming entrances

zooming_entrances
zooming entrances
  • zoomin
  • zoomindown
  • zoominleft
  • zoominright
  • zoominup

zooming exits

zooming_exits
zooming exits
  • zoomout
  • zoomoutdown
  • zoomoutleft
  • zoomoutright
  • zoomoutup

download the full project for this post from the following button

this source is fully free for all time

download as zip


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.