패키지, 저장소 및 앱 카테고리 검색

confetti 표지
패키지 상세v0.8.0

confetti

화려한 커페티를 화면 전체에 흩뿌리세요. 앱 내 성취를 스타일 있게 축하하세요. 커페티의 속도, 각도, 중력 및 양을 제어할 수 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
46.4만
좋아요
1.6천
Pub 점수
160

패키지 설치

flutter pub add confetti

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Confetti는 개발자가 앱 내에서 생동감 있고 애니메이션된 컨페티 폭발을 만들 수 있도록 해주는 Flutter 패키지입니다. 성취, 주요 이정표 또는 특별한 이벤트를 축하할 때 이상적이며, 속도, 각도, 중력 및 입자 수와 같은 사용자 지정 효과를 제공합니다. Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 장치 간 일관된 시각적 매력을 보장합니다. pub add를 통해 간단하게 통합되어 재미있고 동적인 피드백을 통해 사용자 참여를 높입니다. 게임, 보상 시스템, 인터랙티브 앱 순간에 적합합니다.

사용 사례

  • 앱 성취 기념
  • 게임 승리 화면 개선
  • 마일스톤 완료 표시
  • 절기 UI 요소 추가
  • 보상에서 사용자 참여도 향상
  • 기념 애니메이션 만들기

주요 기능

  • 사용자 정의 커페티 속도
  • 조절 가능한 각도 및 중력
  • 사용자 정의 가능한 입자 수
  • 크로스 플랫폼 지원
  • Flutter와의 간단한 통합
  • 부드럽고 애니메이션 효과가 있는 입자 효과

적합한 대상

  • 게임 개발자
  • 재미있는 피드백을 찾는 앱 디자이너
  • 보상 시스템 구현자
  • 인터랙티브 UI 생성자
  • Flutter 초보자들이 애니메이션을 탐색하고 있습니다
  • 성취 추적 기능이 있는 앱

고려 사항

  • 저사양 기기에서 성능에 영향을 미칠 수 있습니다
  • 최적의 시각 효과를 위해 신중한 조정이 필요합니다
  • 미니멀리즘 디자인 스타일에 적합하지 않습니다
  • 입자 물리학 외의 사용자 지정은 제한적
  • 시각적 과부하를 방지하기 위해 적절히 사용하는 것이 좋습니다
  • 플랫폼별 렌더링 기능에 의존합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Blast some confetti all over the screen and celebrate user achievements!

Demo

Video showing the Confetti in Action: https://youtu.be/dGMVyUY4-6M

Live WEB Demo

An old video walkthrough is available here.

Getting Started

To use this plugin, add confetti as a dependency in your pubspec.yaml file.

See the example to get started quickly. To generate the platform folders run:

flutter create .

in the example folder.

To begin you need to instantiate a ConfettiController variable and pass in a Duration argument. The ConfettiController can be instantiated in the initState method and disposed in the dispose method.

In the build method return a ConfettiWidget. The only attribute that is required is the ConfettiController.

Other attributes that can be set are:

  • blastDirectionality -> an enum value to state if the particles shoot in random directions or a specific direction. BlastDirectionality.explosive will shoot in random directions and don't require a blastDirection to be set. BlastDirectionality.directional requires a blastDirection to specify the direction of the confetti.
  • blastDirection -> a radial value to determine the direction of the particle emission. The default is set to PI (180 degrees). A value of PI will emit to the left of the canvas/screen.
  • emissionFrequency -> should be a value between 0 and 1. The higher the value the higher the likelihood that particles will be emitted on a single frame. Default is set to 0.02 (2% chance)
  • numberOfParticles -> the number of particles to be emitted per emission. Default is set to 10
  • shouldLoop -> determines if the emission will reset after the duration is completed, which will result in continues particles being emitted, and the animation looping
  • maxBlastForce -> will determine the maximum blast force applied to a particle within it's first 5 frames of life. The default maxBlastForce is set to 20
  • minBlastForce -> will determine the minimum blast force applied to a particle within it's first 5 frames of life. The default minBlastForce is set to 5
  • displayTarget -> if true a crosshair will be displayed to show the location of the particle emitter
  • colors -> a list of colors can be provided to manually set the confetti colors. If omitted then random colors will be used. A single color, for example [Colors.blue], or multiple colors [Colors.blue, Colors.red, Colors.green] can be provided as an argument in the `ConfettiWidget
  • strokeWidth optionally set to give a stroke to the paint. Needs to be bigger than 0 to be vissible. Default 0.
  • strokeColor optionally set to give a stroke color. Default black.
  • minimumSize -> a Size controlling the minimum possible size of the confetti. To be used in conjuction with maximumSize. For example, setting a minimumSize equal to Size(10,10) will ensure that the confetti will never be smaller than the specified size. Must be positive and smaller than the maximumSize. Can not be null.
  • maximumSize -> a Size controlling the maximum possible size of the confetti. To be used in conjuction with minimumSize. For example, setting a maximumSize equal to Size(100,100) will create confetti with a size somewhere between the minimum and maximum size of (100, 100) [widht, height]. Must be positive and bigger than the minimumSize, Can not be null.
  • gravity -> change the speed at which the confetti falls. A value between 0 and 1. The higher the value the faster it will fall. Default is set to 0.1
  • particleDrag -> configure the drag force to apply to the confetti. A value between 0 and 1. A value of 1 will be no drag at all, while 0.1, for example, will be a lot of drag. Default is set to 0.05
  • canvas -> set the size of the area where the confetti will be shown, by default this is set to full screen size.
  • createParticlePath -> An optional function that retuns a custom Path to generate unique particles. Default returns a rectangular path.
Example of a custom createParticlePath
Path drawStar(Size size) {
    // Method to convert degree to radians
    double degToRad(double deg) => deg * (pi / 180.0);

    const numberOfPoints = 5;
    final halfWidth = size.width / 2;
    final externalRadius = halfWidth;
    final internalRadius = halfWidth / 2.5;
    final degreesPerStep = degToRad(360 / numberOfPoints);
    final halfDegreesPerStep = degreesPerStep / 2;
    final path = Path();
    final fullAngle = degToRad(360);
    path.moveTo(size.width, halfWidth);

    for (double step = 0; step < fullAngle; step += degreesPerStep) {
      path.lineTo(halfWidth + externalRadius * cos(step),
          halfWidth + externalRadius * sin(step));
      path.lineTo(halfWidth + internalRadius * cos(step + halfDegreesPerStep),
          halfWidth + internalRadius * sin(step + halfDegreesPerStep));
    }
    path.close();
    return path;
  }

Enjoy the confetti.

NOTE: Don't be greedy with the number of particles. The more particles that are on screen the more calculations need to be performed. Performance improvements have been made, however this is still ongoing work. Too many particles will result in performance issues. Use wisely and carefully.

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

순위