pardon-dance
A Dart package to effortlessly apply the popular "pardon dance" video effect to your projects. Easily integrate dynamic zooming and panning animations for engaging visual experiences.
Installation
To use this package, add pardon-dance as a dependency in your pubspec.yaml file:
yaml
dependencies:
pardon_dance: ^1.0.0 # Replace with the latest version
Then, run dart pub get to install the package.
Usage
Here are some examples of how to use the pardon-dance package:
1. Basic Zoom and Pan: dart import 'package:flutter/material.dart'; import 'package:pardon_dance/pardon_dance.dart';
class BasicExample extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Basic Pardon Dance')), body: Center( child: PardonDance( child: Image.asset('assets/my_image.jpg'), // Replace with your image zoomFactor: 1.2, panDistance: 20.0, ), ), ); } }
2. Custom Duration and Curve: dart import 'package:flutter/material.dart'; import 'package:pardon_dance/pardon_dance.dart';
class CustomAnimationExample extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Custom Pardon Dance')), body: Center( child: PardonDance( child: Image.asset('assets/another_image.jpg'), // Replace with your image zoomFactor: 1.1, panDistance: 15.0, animationDuration: Duration(milliseconds: 750), animationCurve: Curves.easeInOut, ), ), ); } }
3. Using with a Container: dart import 'package:flutter/material.dart'; import 'package:pardon_dance/pardon_dance.dart';
class ContainerExample extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Pardon Dance with Container')), body: Center( child: PardonDance( child: Container( width: 200, height: 200, color: Colors.blue, child: Center(child: Text('Hello, Pardon Dance!', style: TextStyle(color: Colors.white))), ), zoomFactor: 1.3, panDistance: 25.0, ), ), ); } }
4. Control Animation with a Boolean: dart import 'package:flutter/material.dart'; import 'package:pardon_dance/pardon_dance.dart';
class BooleanControlExample extends StatefulWidget { @override _BooleanControlExampleState createState() => _BooleanControlExampleState(); }
class _BooleanControlExampleState extends State
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Pardon Dance with Boolean Control')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children:
PardonDance(
animate: _animate,
child: Image.asset('assets/yet_another_image.jpg'), // Replace with your image
zoomFactor: 1.15,
panDistance: 18.0,
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
setState(() {
_animate = !_animate;
});
},
child: Text(_animate ? 'Stop Animation' : 'Start Animation'),
),
,
),
),
);
}
}
Features
- Effortless Integration: Easily add the "pardon dance" effect to any widget.
- Customizable Parameters: Control zoom factor, pan distance, animation duration, and animation curve.
- Boolean Control: Start and stop the animation programmatically.
- Wide Compatibility: Works with various widgets, including images, containers, and custom components.
- Clean and Simple API: Easy to understand and use.
License
MIT License
This package is part of the pardon-dance ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/video/blog/unlocking-the-magic-of-pardon-dance-the-viral-video-effect-taking-over-social-media/