render: function()

in www/src/utils/particles.ts [190:257]


	render: function(ctx) {
		if (this.destroyed) {
			return;
		}

		const particles = this._targets.particles;

		for (let i = 0, len = particles.length; i < len; i++) {
			particles[i].addSpeed(Vector.sub(this, particles[i]).normalize().scale(this.gravity));
		}

		this._easeRadius = (this._easeRadius + (this.radius - this.currentRadius) * 0.07) * 0.95;
		this.currentRadius += this._easeRadius;
		if (this.currentRadius < 0) {
			this.currentRadius = 0;
		}

		if (this._collapsing) {
			this.radius *= 0.75;
			if (this.currentRadius < 1) {
				this.destroyed = true;
			}
			this._draw(ctx);
			return;
		}

		const gravities = this._targets.gravities,
			area = this.radius * this.radius * Math.PI;

		let g, absorp;

		for (let i = 0, len = gravities.length; i < len; i++) {
			g = gravities[i];

			if (g === this || g.destroyed) {
				continue;
			}

			if (
				(this.currentRadius >= g.radius || this.dragging) &&
				this.distanceTo(g) < (this.currentRadius + g.radius) * 0.85
			) {
				g.destroyed = true;
				this.gravity += g.gravity;

				absorp = Vector.sub(g, this).scale(g.radius / this.radius * 0.5);
				this.addSpeed(absorp);

				const garea = g.radius * g.radius * Math.PI;
				this.currentRadius = Math.sqrt((area + garea * 3) / Math.PI);
				this.radius = Math.sqrt((area + garea) / Math.PI);
			}

			g.addSpeed(Vector.sub(this, g).normalize().scale(this.gravity));
		}

		if (GravityPoint.interferenceToPoint && !this.dragging) {
			this.add(this._speed);
		}

		this._speed = new Vector();

		if (this.currentRadius > GravityPoint.RADIUS_LIMIT) {
			this.collapse();
		}

		this._draw(ctx);
	},