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

newton_particles 표지
패키지 상세v0.4.1

newton_particles

사용자 정의 가능한 입자 발사기로 인상적인 애니메이션을 만들어보세요. Flutter 앱에 비, 연기 등 다양한 효과를 추가하세요!

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.3천
좋아요
123
Pub 점수
150

패키지 설치

flutter pub add newton_particles

패키지 개요

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

Newton_Particles는 구성 가능한 파티클 발사기를 사용하여 시각적으로 매력적인 애니메이션을 만들 수 있도록 해주는 Flutter 패키지입니다. 비, 연기 및 동적 시각적 흔적과 같은 다양한 효과를 지원하며, 몰입형 배경 효과로 앱 인터페이스를 강화합니다. Android, iOS, Web, macOS, Windows, Linux에서 성능을 고려해 설계되었으며, Flutter 앱에 원활하게 통합됩니다. 사용자 정의 가능한 파티클 행동과 실시간 제어 기능을 통해 사용자 인터페이스에 분위기 깊이와 상호작용을 더하는 데 이상적입니다.

사용 사례

  • 애니메이션 배경 추가
  • 비 또는 눈 효과 만들기
  • 게임 시각 효과 향상
  • 연기 또는 화재 시뮬레이션
  • 앱 온보딩 애니메이션 개선

주요 기능

  • 사용자 정의 가능한 입자 방출기
  • 실시간 애니메이션 제어
  • 크로스 플랫폼 지원
  • 여러 종류의 입자 유형 지원
  • 경량이고 성능이 뛰어남
  • Flutter 위젯과의 간편한 통합

적합한 대상

  • 시각적 매력이 필요한 UI 디자이너
  • 파티클 효과가 필요한 게임 개발자
  • 동적 배경을 원하는 앱 제작자
  • 몰입형 경험을 구축하는 개발자
  • 애니메이션 세부 사항에 집중하는 프론트엔드 팀

고려 사항

  • 저사양 기기에서 성능에 영향을 미칠 수 있습니다
  • 입자 시스템의 기본 사항을 이해해야 합니다
  • 기본 예제 외에 문서가 제한적
  • 고주파 입자 생성에 최적화되지 않음
  • 명확성을 위해 최소한의 겹치는 레이어와 함께 사용하는 것이 가장 좋습니다

원본 README

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

Newton logo

License: MIT pub package

Particle Emitter for Flutter

Newton is a highly configurable particle emitter package for Flutter, now with advanced support for both deterministic and physics-based animations. With Newton, you can create captivating animations such as rain, smoke, explosions, and more, along with realistic physics-driven effects like gravity and collisions. This allows you to easily add both visually stunning and physically accurate effects to your Flutter applications, enhancing the user experience with dynamic and interactive animations.

ezgif-2-55326df4fb

Features
  • Highly Configurable: Newton offers an extensive range of options to fine-tune your particle animations. You can adjust particle appearance, behavior, movement, and physics properties, providing complete control over your animations.

  • Interactive Animation Configurator: Create your particle animations visually using the included app configurator. Experiment with different settings, preview animations in real-time, and copy the generated code directly into your project.

  • Custom Particle Design: Design your particle effects to seamlessly integrate with your app’s aesthetic. Use custom shapes, colors, and sizes to craft truly unique animations that suit your needs.

  • Comprehensive Documentation: Detailed guides and examples are available to help you easily create popular particle effects like rain, smoke, and explosions.

  • Widget Collisions: Particles can interact with Flutter widgets using NewtonCollider, creating engaging interactive effects with accurate physics including support for rounded corners.

  • Efficient Performance: Newton is optimized for performance, ensuring smooth animations even on lower-end devices without compromising on visual quality.

Installation

To use Newton, simply add it as a dependency in your pubspec.yaml file:

dependencies:
  newton_particles: ^0.4.1

Then, run flutter pub get to fetch the package.

Web Setup (Required for WASM with Physics Effects)

If you're building for web with WASM and using physics effects, you need to add a helper script to your web/index.html file. Add this script before the flutter_bootstrap.js script:

<body>
  <script>
    window._dynamicImport = (path) => import(path);
  </script>
  <script src="flutter_bootstrap.js" async></script>
</body>

This helper is required for Chipmunk2D's WASM module to load properly on web.

What's New in 0.4.1

Fixes
  • chipmunk2d_physics_ffi 1.0.4: Bumps the Chipmunk2D FFI dependency to fix Android builds for Google Play’s 16 KB page size requirement and Windows build_runner when prebuilt native libraries were missing. See issue #51 and issue #52.

What's New in 0.4.0

Breaking Changes
  • Physics Engine Migration: Migrated from Forge2D (Box2D) to Chipmunk2D for improved performance and stability. The public API remains compatible, but the underlying physics engine has changed. If you have direct dependencies on forge2d, you'll need to update your code.
Major Updates
  • Chipmunk2D Integration: Full integration with Chipmunk2D physics engine, providing better performance for physics-based particle effects.
  • Enhanced Performance: Improved physics simulation performance, especially for large numbers of active particles (now supports up to 3000 particles with warnings).

What's New in 0.3.0

Breaking Changes
  • Renamed Physics Effects: RelativisticEffect is now PhysicsEffect and RelativisticEffectConfiguration is now PhysicsEffectConfiguration for better clarity. The old names are deprecated.
  • Revamped Configuration API: Configuration properties are now organized into logical groups (PhysicsProperties, VisualProperties, EmissionProperties, etc.) for better type safety and code organization. See the Migration Guide for upgrade instructions.
Major Features
  • Widget Collisions: New NewtonCollider widget allows particles to collide with Flutter widgets! Create interactive effects where particles bounce off UI elements with accurate physics, including support for rounded corners, friction, and restitution.
  • Effect Presets: Quick-start presets for common effects including confetti, rain, snow, explosions, and fountains. Perfect for rapid prototyping or production use.
  • Code Generator: Enhanced configurator now allows you to copy generated code directly! Configure your effects visually and get ready-to-use Dart code with a single click.
  • Particle Pool: Memory-efficient particle reuse system that reduces allocations and improves performance.
  • Debug Data Stream: Real-time monitoring of particle effects with debugDataStream for tracking active particles and performance metrics.
Performance Improvements
  • Viewport Culling: Particles outside the visible area are now automatically culled, dramatically improving performance for large particle counts.
  • Optimized Rendering: Improved particle sorting and fixture caching for smoother animations.
  • Optimized Collider Reporting: Reduced unnecessary work in collider position reporting.
Bug Fixes
  • Fixed clearEffects() not triggering widget rebuilds
  • Fixed colliders stopping to work when configuration properties change
  • Improved collider stability and preservation during widget rebuilds
  • Enhanced collider syncing to physics effects

Usage

  1. Import the Newton package:
import 'package:newton_particles/newton_particles.dart';
  1. Create a Newton widget and add it to your Flutter UI with the desired effects:
Newton(
    // Add any kind of effects to your UI
    // For example:
    effectConfigurations: [
        PhysicsEffectConfiguration(
            physicsProperties: const PhysicsProperties(
                gravity: Gravity.earthGravity,
                angle: NumRange.single(90),
                velocity: NumRange.between(Velocity.stationary, Velocity.stationary),
            ),
            visualProperties: const VisualProperties(
                endScale: NumRange.single(1),
                fadeOutThreshold: NumRange.between(0.6, 0.8),
            ),
            emissionProperties: const EmissionProperties(
                origin: Offset.zero,
                maxOriginOffset: Offset(1, 0),
                particleLifespan: DurationRange.between(Duration(seconds: 7), Duration(seconds: 10)),
            ),
            particleConfiguration: const ParticleConfiguration(
                shape: CircleShape(),
                size: Size(5, 5),
            ),
        ),
    ],
)

Try our effect configurator to tweak your effect and copy the generated code directly into your project.

Example

For a quick start, here's an example of creating a simple rain effect using Newton:

import 'package:flutter/material.dart';
import 'package:newton_particles/newton_particles.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await initializeNewton();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Newton Rain Example')),
        body: Newton(
          effectConfigurations: [
            PhysicsEffectConfiguration(
              physicsProperties: const PhysicsProperties(
                gravity: Gravity.earthGravity,
                angle: NumRange.single(90),
                velocity: NumRange.between(Velocity.stationary, Velocity.stationary),
              ),
              visualProperties: const VisualProperties(
                endScale: NumRange.single(1),
                fadeOutThreshold: NumRange.between(0.6, 0.8),
              ),
              emissionProperties: const EmissionProperties(
                origin: Offset.zero,
                maxOriginOffset: Offset(1, 0),
                particleLifespan: DurationRange.between(Duration(seconds: 7), Duration(seconds: 10)),
              ),
              particleConfiguration: const ParticleConfiguration(
                shape: CircleShape(),
                size: Size(5, 5),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Documentation

For detailed documentation and examples, visit the Newton Documentation.

Contributing

We welcome contributions from the community! If you find any issues or have ideas for improvements, feel free to open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.


Note: This package is under active development, and breaking changes might be introduced in future versions until a stable 1.0.0 release. Please review the changelog when updating versions.

카테고리

의존성

의존성 목록 4 개

소스 저장소

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