Skip to content

🎈 v3 Proposal Issue #86

@yiliansource

Description

@yiliansource

This issue is dedicated to hold the information on the planned v3 rewrite of the library.
Discussion on the proposed changes is encouraged.

Proposed changes

Modules

Problem

Creating modules via the fluent API is confusing and restrictive.

Solution

(particle) => void (particle.size = Math.min(1, particle.lifetime * 3);

Why overcomplicate things when they can be kept simple. We can always ship pre-defined modifiers if we want to.

Custom Effects

Problem

Creating custom effects is messy (see https://party.js.org/docs/guides/custom-effects#example and consider overrideDefaults, the modules, etc.).

Solution

function myEffect(source): party.Emitter {
  const myEmitter = new party.Emitter({
    modules: [
      (particle) => void (particle.size = Math.min(1, particle.lifetime * 3))
    ],
    bursts: [{ time: 0, count: 20 }],
    source: source,
    initialVelocity: () => party.variation.skew(, party.unit.Degrees(40)),
    initialSpeed: 

Minimize bundle size

Problem

Writing everything (like math, color, etc.) by hand is unreliable and not the focus of this package.

Solution

Small, reliable, battle-tested utility libraries should be used to outsource features (like math, color, etc.). Ideally, this would fully utilize tree-shaking during the build process to minimize the final bundle size.

Cleaner integration into consumer projects

Problem

Users are experiencing issues when using this library with bundlers, so an ideal package build pipeline and structure should be looked into (see #85).

Solution

Distributed package structure:

bundle/
  party.js
  party.min.js
dist/
  foo/
  bar/
  index.js
  index.d.ts
scripts/
package.json

Contrary to v2, the library should no longer ship source maps.

More realistic effects

Problem

The main target of this is the confetti effect - currently they only rotate at a fixed angular velocity, it would be interesting to actually have them "twirl" like small papers falling towards the ground. This could involve taking air resistance into account while falling.

Solution

TODO.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions