Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var f = this.getArrProp("f");
var emitterV = this.getProp("emitter");
this.proton = new Proton();
var emitter = void 0;
if (emitterV === "follow") {
emitter = new Proton.FollowEmitter();
} else {
emitter = new Proton.Emitter();
}
emitter.rate = new Proton.Rate(num, rps);
emitter.addInitialize(new Proton.Mass(mass));
emitter.addInitialize(new Proton.Radius(radius));
emitter.addInitialize(new Proton.Life(life));
emitter.addInitialize(new Proton.Velocity(v, tha, "polar"));
if (body) emitter.addInitialize(new Proton.Body(body));
var pos = void 0;
if (position === "all" || position === "screen") {
pos = new Proton.Position(new Proton.RectZone(0, 0, canvas.width, canvas.height));
} else if ((typeof position === "undefined" ? "undefined" : _typeof(position)) === "object") {
pos = new Proton.Position(new Proton.RectZone(position.x, position.y, position.width, position.height));
} else {
emitter.p.x = canvas.width / 2;
emitter.p.y = canvas.height / 2;
}
emitter.addInitialize(pos);
/// behaviour
var alphaB = alpha ? new Proton.Alpha(alpha[0], alpha[1]) : new Proton.Alpha(0, 1);
once = _ref$once === undefined ? "all" : _ref$once,
_ref$alpha = _ref.alpha,
alpha = _ref$alpha === undefined ? 0.85 : _ref$alpha,
_ref$gravity = _ref.gravity,
gravity = _ref$gravity === undefined ? 3.5 : _ref$gravity;
var emitter = this.proton.pool.get(Proton.Emitter);
if (!emitter.completed) {
emitter.rate = new Proton.Rate(this.props.num ? new Proton.Span(this.props.num) : new Proton.Span(4, 9), new Proton.Span(1.6, 2.2));
var radiusInit = mainEmitter ? new Proton.Radius(10, 110) : new Proton.Radius(3, radius);
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(radiusInit);
emitter.addInitialize(new Proton.Life(3, 6));
emitter.addInitialize(new Proton.Velocity(new Proton.Span(4, 6), new Proton.Span(-90, 90), "polar"));
emitter.addBehaviour(new Proton.Alpha(alpha, 0.2));
emitter.addBehaviour(new Proton.Color(color));
emitter.addBehaviour(new Proton.Scale(1, 0.3));
emitter.addBehaviour(new Proton.Rotate());
emitter.addBehaviour(new Proton.Gravity(gravity));
emitter.addBehaviour(this.customDeadBehaviour(canvas));
emitter.addBehaviour(new Proton.CrossZone(new Proton.RectZone(0, 0, canvas.width, canvas.height), zone));
}
emitter.p.x = x;
emitter.p.y = y;
if (once === "once") emitter.emit("once");else emitter.emit();
this.proton.addEmitter(emitter);
const emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(
this.props.num ? new Proton.Span(this.props.num) : new Proton.Span(100),
new Proton.Span(0.05, 0.2)
);
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(1, 4));
emitter.addInitialize(new Proton.Life(Infinity));
const pointZone = new Proton.Position(
new Proton.RectZone(0, 0, width, height)
);
emitter.addInitialize(pointZone);
emitter.addInitialize(
new Proton.Velocity(
new Proton.Span(0.3, 0.6),
new Proton.Span(0, 360),
"polar"
)
);
emitter.addBehaviour(new Proton.Alpha(Proton.getSpan(0.2, 0.9)));
emitter.addBehaviour(new Proton.Color(this.props.color || "#333"));
this.crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, width, height),
"cross"
);
emitter.addBehaviour(this.crossZoneBehaviour);
emitter.emit("once");
emitter.damping = 0;
createProton(canvas, width, height) {
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(this.props.num ? this.props.num : 50);
emitter.damping = 0;
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(4, 70));
emitter.addInitialize(
new Proton.Velocity(new Proton.Span(2, 10), new Proton.Span(0), "polar")
);
emitter.addInitialize(
new Proton.Position(
new Proton.LineZone(0, canvas.height, canvas.width, canvas.height)
)
);
const dis = 150;
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(
0 - dis,
0 - dis,
canvas.width + 2 * dis,
canvas.height + 2 * dis
),
"cross"
createProton(canvas, width, height) {
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.damping = 0.008;
emitter.rate = new Proton.Rate(this.props.num ? this.props.num : 50);
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(5, 9));
emitter.addInitialize(
new Proton.Velocity(
new Proton.Span(1.5),
new Proton.Span(0, 360),
"polar"
)
);
emitter.addInitialize(
new Proton.Position(new Proton.RectZone(0, 0, width, height))
);
const mouseInfo = {
x: width / 2,
y: height / 2
};
const attractionBehaviour = new Proton.Attraction(mouseInfo, 0, 0);
const crossZoneBehaviour = new Proton.CrossZone(
createProton(canvas, width, height) {
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.damping = 0.008;
emitter.rate = new Proton.Rate(this.props.num ? this.props.num : 250);
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(4));
emitter.addInitialize(
new Proton.Velocity(
new Proton.Span(1.5),
new Proton.Span(0, 360),
"polar"
)
);
const mouseObj = {
x: width / 2,
y: height / 2
};
const attractionBehaviour = new Proton.Attraction(mouseObj, 0, 0);
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
"cross"
);
emitter.addBehaviour(new Proton.Color("random"));
createProton(canvas, width, height) {
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.damping = 0.008;
emitter.rate = new Proton.Rate(250);
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(4));
emitter.addInitialize(
new Proton.Velocity(
new Proton.Span(1.5),
new Proton.Span(0, 360),
"polar"
)
);
const mouseObj = {
x: width / 2,
y: height / 2
};
const attractionBehaviour = new Proton.Attraction(mouseObj, 0, 0);
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
"cross"
);
emitter.addBehaviour(new Proton.Color("random"));
createProton(canvas, width, height) {
const context = canvas.getContext("2d");
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(
this.props.num ? new Proton.Span(this.props.num) : new Proton.Span(4, 9),
new Proton.Span(0.8, 1.3)
);
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(1, 50));
emitter.addInitialize(new Proton.Life(5, 6));
emitter.addInitialize(
new Proton.Velocity(
new Proton.Span(5, 8),
new Proton.Span(30, 70),
"polar"
)
);
emitter.addBehaviour(new Proton.Alpha(1, 0));
emitter.addBehaviour(
new Proton.Color(["#36aaf3", "#fd769c", "#94ff22", "#ffa545", "#ffffff"])
);
emitter.addBehaviour(new Proton.Scale(0.7, 1));
emitter.addBehaviour(new Proton.Gravity(3));
emitter.addBehaviour(new Proton.Collision(emitter));
emitter.addBehaviour(this.customDeadBehaviour(canvas));
emitter.addBehaviour(
new Proton.CrossZone(