funwithflutter/flutter_confetti

Optionally disable rotation in X, Y, and/or Z-Axis

Opened this issue · 1 comments

It would be great if it was possible to optionally disable each axis rotation.

Simply something like:

  void _paintParticles(Canvas canvas) {
    for (final particle in particles) {

      final rotationMatrix4 = Matrix4.identity()
        ..translate(particle.location.dx, particle.location.dy);

      if(rotateX) rotationMatrix4 = rotationMatrix4.rotateX(particle.angleX);
      if(rotateY) rotationMatrix4 = rotationMatrix4.rotateY(particle.angleY);
      if(rotateZ) rotationMatrix4 = rotationMatrix4.rotateZ(particle.angleZ);

      final finalPath = particle.path.transform(rotationMatrix4.storage);
      canvas.drawPath(finalPath, _particlePaint..color = particle.color);
      if (strokeWidth > 0) {
        canvas.drawPath(finalPath, _particleStrokePaint);
      }
    }
  }

This would be very helpful, if possible