पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

GitHub रिपॉज़िटरीgskinner/particle_field

कण क्षेत्र

अपने UI में उच्च प्रदर्शन वाले कस्टम कण प्रभाव जोड़ने के लिए एक Flutter विजेट।

कण क्षेत्र प्रोजेक्ट कवर
स्टार
29
फ़ोर्क
6
अंतिम पुश (UTC)
12 मार्च 2023
प्रोजेक्ट स्थिति
सक्रिय

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

Particle Field

A Flutter Widget for adding high performance custom particle effects to your UI.

Simple Example

Easy to use: just write a simple onTick handler to manage a list of particles. Architected to be highly extensible. Utilizes CustomPainter and drawAtlas to offer exceptional performance.

// NOTE: this example uses `rnd` (see "Complimentary Libraries" below)
ParticleField field = ParticleField(
  spriteSheet: sparkleSpriteSheet,
  // top left will be 0,0:
  origin: Alignment.topLeft,
  // onTick is where all the magic happens:
  onTick: (controller, elapsed, size) {
    List<Particle> particles = controller.particles;
    // add a new particle each frame:
    particles.add(Particle(x: rnd(size.width), vx: rnd(-1, 1)));
    // update existing particles:
    for (int i = particles.length - 1; i >= 0; i--) {
      Particle particle = particles[i];
      // call update, which automatically adds vx/vy to x/y
      // add some gravity (ie. increase vertical velocity)
      // and increment the frame
      particle.update(vy: particle.vy + 0.1, frame: particle.frame + 1);
      // remove particle if it's out of bounds:
      if (!size.contains(particle.toOffset())) particles.removeAt(i);
    }
  },
)

See the API Reference for more information.

Complimentary Libraries

The rnd package makes working with random values in your particle systems much simpler. For example, if you wanted 20% of your particles to move left, and 80% right at a velocity of between 2 and 5:

particle.vx = rnd(2, 5) * rnd.getSign(0.8)

If you're looking to add animated effects to your UI in addition to particles, check out the Flutter Animate library for pre-made effects, custom effects, and simplified animated builders.

Text("Hello").animate().fadeIn().slide()
Grant Skinner GitHub avatar
भाषाएँDartC++CMakeHTMLCSwiftKotlinObjective-C

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 3 आइटम

  • flutter{"sdk":"flutter"}
  • flutter_testडेवलपमेंट{"sdk":"flutter"}
  • flutter_lintsडेवलपमेंट^2.0.0

अपने प्रोजेक्ट के लिए रिपॉज़िटरी कैसे चुनें?

उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।

  1. नाम, लेखक या विवरण से खोजें और तकनीकी विषय से परिणाम सीमित करें।
  2. स्टार, फ़ोर्क और हाल के पुश की तुलना करें। स्टार रुचि दर्शाते हैं, गुणवत्ता की गारंटी नहीं।
  3. उपयोग से पहले GitHub पर README, लाइसेंस और Issues जाँचें।

स्रोत और रखरखाव

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗