particles 0.0.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 53

Particles #

Port of Vincent Garreau' particles.js written in Dart with added features.

Instalation #

  $ pub get particles

Usage #

The particle class takes 2 optional named arguments: id of type String, and config of type Map<String, dynamic>.

Particles particles = new Particles(id: 'id', config: {/*configuration map*/}).start();

Configuration #

The default config Map looks something like this

Map<String, dynamic> settings = {
  'particles': {
    'number': {
      'value': 100,
      'density': {
        'enable': true,
        'value_area': 800
      }
    },
    'color': {
      'value': '#fff'
    },
    'shape': {
      'type': 'circle',
      'stroke': {
        'width': 0,
        'color': '#ff0000'
      },
      'polygon': {
        'nb_sides': 5
      },
      'character': {
        'value': 'P',
        'font': 'arial',
        'style': 'normal',
        'weight': 'normal',
      },
      'image': {
        'src': '',
        'width': 100,
        'height': 100
      }
    },
    'opacity': {
      'value': 1,
      'random': false,
      'anim': {
        'enable': false,
        'speed': 2,
        'opacity_min': 0,
        'sync': false
      }
    },
    'size': {
      'value': 10,
      'random': false,
      'anim': {
        'enable': false,
        'speed': 20,
        'size_min': 0,
        'sync': false
      }
    },
    'line_linked': {
      'enable': true,
      'distance': 100,
      'color': '#FFFFFF',
      'opacity': 1,
      'width': 1
    },
    'move': {
      'enable': true,
      'speed': 6,
      'direction': 'none',
      'random': false,
      'straight': false,
      'out_mode': 'out',
      'parallax': true,
      'bounce': false,
      'parallax': false,
      'attract': {
        'enable': false,
        'rotateX': 3000,
        'rotateY': 3000
      }
    }
  },
  'interactivity': {
    'detect_on': 'canvas',
    'events': {
      'onhover': {
        'enable': true,
        'mode': 'grab'
      },
      'onclick': {
        'enable': true,
        'mode': 'push'
      },
      'resize': true
    },
    'modes': {
      'grab':{
        'distance': 100,
        'line_linked':{
          'opacity': 1
        }
      },
      'bubble':{
        'distance': 100,
        'size': 40,
        'duration': 0.4,
        'opacity': 8,
        'speed': 3
      },
      'repulse':{
        'distance': 200,
        'duration': 0.4
      },
      'push':{
        'particles_nb': 4
      },
      'remove':{
        'particles_nb': 2
      }
    }
  },
  'retina_detect': false
};
keytypedefaultnotes
particles > number > valuenum100
particles > number > density > enablebooltrue
particles > number > density > value_areanumber800
particles > color > valueString: Hex or "random"<br /> List<String>: Hex <br /> Map<String, int>: RGB or HSL#FFFFFFExamples: <br /> "#b61924" <br /> ["#b61924", "#333333", "999999"] <br />{r:182, g:25, b:36} <br /> {h:356, s:76, l:41} <br /> "random"
particles > shape > typeString <br /> List<String>"circle"Examples: <br /> "circle" <br /> "edge" <br /> "triangle" <br /> "polygon" <br /> "star" <br /> "image"
particles > shape > stroke > widthnum0
particles > shape > stroke > colorString"#FF0000"
particles > shape > polygon > nb_slidesnum5
particles > shape > character > valueString"P"
particles > shape > character > fontString"arial"
particles > shape > character > styleString"normal"Possible values are the same as in the CSS font-style property
particles > shape > character > weightString"normal"Possible values are the same as in the CSS font-style property
particles > shape > image > srcString"particle.png"Needs cors access
particles > shape > image > widthnum100
particles > shape > image > heightnum100
particles > opacity > valuenum0.750 to 1
particles > opacity > randomboolfalse
particles > opacity > anim > enableboolfalse
particles > opacity > anim > speednum2
particles > opacity > anim > opacity_minnum00 to 1
particles > opacity > anim > syncboolfalse
particles > size > valuenum10
particles > size > randomboolfalse
particles > size > anim > enableboolfalse
particles > size > anim > speednum20
particles > size > anim > size_minnum0
particles > size > anim > syncboolfalse
particles > line_linked > enablebooltrue
particles > line_linked > distancenum100
particles > line_linked > colorString#FFFFFF
particles > line_linked > opacitynum10 to 1
particles > line_linked > widthnum1
particles > move > enablebooltrue
particles > move > speednum6
particles > move > directionString"none"Possible values: <br />"none" <br /> "top" <br /> "top-right" <br /> "right" <br /> "bottom-right" <br /> "bottom" <br /> "bottom-left" <br /> "left" <br /> "top-left"
particles > move > randomboolfalse
particles > move > straightboolfalse
particles > move > out_modeString"out"Possible values: <br /> "out" <br /> "bounce"
particles > move > parallaxboolfalse
particles > move > bounceboolfalseBounce between particles
particles > move > attract > enableboolfalse
particles > move > attract > rotateXnum3000
particles > move > attract > rotateYnum3000
interactivity > detect_onString"canvas"Possible values: <br /> "canvas" <br /> "window"
interactivity > events > onhover > enablebooltrue
interactivity > events > onhover > modeString <br /> List<String>"grab"Possible values: <br /> "grab" <br /> "bubble" <br /> "repulse"
interactivity > events > onclick > enablebooltrue
interactivity > events > onclick > modeString <br /> List<String>"push"Possible values: <br /> "push" <br /> "remove" <br /> "bubble" <br /> "repulse"
interactivity > events > resizebooltrue
interactivity > events > modes > grab > distancenum100
interactivity > events > modes > grab > line_linked.opacitynum0.750 to 1
interactivity > events > modes > bubble > distancenum100
interactivity > events > modes > bubble > sizenum40
interactivity > events > modes > bubble > durationnum0.4in seconds
interactivity > events > modes > repulse > distancenum200
interactivity > events > modes > repulse > durationnum0.4in seconds
interactivity > events > modes > push > particles_nbnum4
interactivity > events > modes > push > particles_nbnum2
retina_detectboolfalse

0.0.1 - January 2, 2019 #

  • First Release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  particles: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:particles/particles.dart';
  
Version Uploaded Documentation Archive
0.0.2 Jan 3, 2019 Go to the documentation of particles 0.0.2 Download particles 0.0.2 archive
0.0.1 Jan 2, 2019 Go to the documentation of particles 0.0.1 Download particles 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13

Platforms

Detected platforms: web

Primary library: package:particles/particles.dart with components: html.

Health issues and suggestions

Document public APIs. (-1 points)

21 out of 21 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/particles.dart. (-1.49 points)

Analysis of lib/particles.dart reported 3 hints:

line 149 col 28: Use = to separate a named parameter from its default value.

line 219 col 8: Use isNotEmpty instead of length

line 220 col 13: Use isNotEmpty instead of length

Format lib/src/particle.dart.

Run dartfmt to format lib/src/particle.dart.

Format lib/src/util.dart.

Run dartfmt to format lib/src/util.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and particles.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0