vitality 2.0.0 vitality: ^2.0.0 copied to clipboard
Introducing a powerful Flutter package that lets you effortlessly create stunning live animations in the background. With just 10 lines of code, you can add randomly moving icons, circles, rectangles, [...]
vitality #
- Introducing a powerful Flutter package that lets you effortlessly create stunning live animations in the background. With just 10 lines of code, you can add randomly moving icons, circles, rectangles, and more to your app, resulting in a visually captivating experience.
Examples #
Here is some examples of using vitality library :
usage : #
- The vitality package is incredibly user-friendly, making it a breeze to incorporate into your code. Take a look at the example below to quickly grasp how to use it:
Vitality.randomly(
background: Colors.black,
maxOpacity: 0.8,
minOpacity: 0.3,
itemsCount: 80,
enableXMovements: false,
whenOutOfScreenMode: WhenOutOfScreenMode.Teleport,
maxSpeed: 1.5,
maxSize: 30,
minSpeed: 0.5,
randomItemsColors: [Colors.yellowAccent, Colors.white],
randomItemsBehaviours: [
ItemBehaviour(shape: ShapeType.Icon, icon: Icons.star),
ItemBehaviour(shape: ShapeType.Icon, icon: Icons.star_border),
ItemBehaviour(shape: ShapeType.StrokeCircle),
],
)
-
The "whenOutOfScreenMode" parameter determines how a shape behaves at the screen edge :
- none : It does nothing and continues its movements out the screen.
- Reflect : It bounces and returns in the oppisite direction.
- Teleport : It continues its movements to the other side of the screen.
-
The "randomItemsBehaviours" parameter determines the shapes that the library can generate and defines the available options for generating shapes :
-
You can choose one from the ShapeType enum (FilledCircle, StrokeCicle, FilledRectangle, Icon, ...)
ItemBehaviour(shape: ShapeType.StrokeCircle)
-
if you chose the icon type you also have to pass an IconData to the Item Behaviour
ItemBehaviour(shape: ShapeType.Icon, icon: Icons.star)
-