This force creates a trap based on any type of polygon that attracts particles as long as they are outside the polygon, while leaving particles inside the polygon unaffected. The trap as such has no walls and particles are allowed to leave it, but they will be pulled back as soon as they exits the polygon.
The following parameters defines the training of the force and can be passed
along a call to
polygon : A two column matrix giving the corners of the polygon, or a
list of matrices to use multiple polygons. If multiple polygons are
overlapping it is considered a hole.
strength : The attractive force applied to the particle. Particles are
attracted towards the closest part of the polygon, rather than the center,
and the attraction is stronger for particles moving away from the polygon
than for those moving towards it. (tidy eval)
min_dist : A lower distance threshold below which the strength is not
increased. The attraction of the trap falls of with the square of the
distance to the particle, so particles close by can get an enormous
attraction unless this threshold is set (so much that the shoot out of the
other side of the trap).
distance_falloff : How should the attractive force deteriorate with the
distance between the polygon and the particle. Defaults to 2 (quadratic
falloff) (tidy eval)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.