Feature request: Add spread option
Opened this issue · 3 comments
A spread option would be nice. E.g. [0, 1], where 0 is no spread, that is particles are shot in a line, where 1 is 360 deg spread.
You still should be able to randomize the spread, so perhaps a randomize option could also be added, e.g. [0, 1] where 0 is no random, that is always in a line and 1 is full random, e.g. 360 deg spread even when spread is 0. Or you could add a spread range e.g. [0.2, 0.5], so spread in between these values adding a random element in between.
An option to determine the spread of the starting position between the particles would also be nice.
Also, a variation of the particle rotation could perhaps be nice, and perhaps disable Z rotation all together.
YES! Man, I have been playing with all the options just to find out that there is no way to adjust the spread. Really disappointing. Hopefully this will get added 🙏
as a temporary workaround, you could use many ConfettiWidget
s with a single controller (so they all fire at the same time) and slightly change blastDirection
for each of the widgets
I wanted to get a blast from bottom center that will cover more or less the whole page, so I created 3 widgets with these directions:
- -pi / 2 + 0.15
- -pi / 2
- -pi / 2 - 0.15
My build method implementation
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: ConfettiWidget(
confettiController: _controller,
blastDirection: -pi / 2 + 0.15,
emissionFrequency: 0,
numberOfParticles: 20,
maxBlastForce: 120,
minBlastForce: 60,
),
),
Align(
alignment: Alignment.bottomCenter,
child: ConfettiWidget(
confettiController: _controller,
blastDirection: -pi / 2,
emissionFrequency: 0,
numberOfParticles: 20,
maxBlastForce: 120,
minBlastForce: 60,
),
),
Align(
alignment: Alignment.bottomCenter,
child: ConfettiWidget(
confettiController: _controller,
blastDirection: -pi / 2 - 0.15,
emissionFrequency: 0,
numberOfParticles: 20,
maxBlastForce: 120,
minBlastForce: 60,
),
),
],
),
);
}
This would be great as confetti seems to suck up memory after a while