Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new Proton.Span(0, 360),
"polar"
)
);
emitter.addInitialize(
new Proton.Position(
new Proton.RectZone(0, 0, canvas.width, canvas.height)
)
);
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
"cross"
);
emitter.addBehaviour(crossZoneBehaviour);
emitter.addBehaviour(new Proton.Alpha(Proton.getSpan(0.35, 0.55)));
emitter.addBehaviour(new Proton.Color(this.getColor()));
emitter.addBehaviour(new Proton.RandomDrift(50, 50, 0.5));
emitter.emit("once");
this.proton.addEmitter(emitter);
const renderer = new Proton.CanvasRenderer(canvas);
this.proton.addRenderer(renderer);
this.crossZoneBehaviour = crossZoneBehaviour;
}
new Proton.Span(0, 360),
"polar"
)
);
emitter.addInitialize(
new Proton.Position(
new Proton.RectZone(0, 0, canvas.width, canvas.height)
)
);
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
"cross"
);
emitter.addBehaviour(crossZoneBehaviour);
emitter.addBehaviour(new Proton.Alpha(Proton.getSpan(0.35, 0.55)));
emitter.addBehaviour(new Proton.Color(this.colors, "random"));
emitter.addBehaviour(new Proton.RandomDrift(50, 50, 0.5));
emitter.emit("once");
this.proton.addEmitter(emitter);
const renderer = new Proton.CanvasRenderer(canvas);
this.proton.addRenderer(renderer);
this.crossZoneBehaviour = crossZoneBehaviour;
}
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;
this.proton.addEmitter(emitter);
this.proton.addRenderer(this.createRenderer(canvas, emitter));
}
value: function createProton(canvas, width, height) {
this.proton = new Proton();
var 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)));
var dis = 150;
var crossZoneBehaviour = new Proton.CrossZone(new Proton.RectZone(0 - dis, 0 - dis, canvas.width + 2 * dis, canvas.height + 2 * dis), "cross");
emitter.addBehaviour(crossZoneBehaviour);
emitter.addBehaviour(new Proton.Alpha(Proton.getSpan(0.1, 0.55)));
emitter.addBehaviour(new Proton.Color(this.colors));
emitter.emit("once");
this.proton.addEmitter(emitter);
var renderer = this.createRenderer(canvas);
this.proton.addRenderer(renderer);
this.crossZoneBehaviour = crossZoneBehaviour;
emitter.preEmit(2);
}
}, {
value: function createProton(canvas, width, height) {
this.proton = new Proton();
var emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(this.props.num || 20);
emitter.damping = 0.008;
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(30, 600));
emitter.addInitialize(new Proton.Velocity(new Proton.Span(0.5), new Proton.Span(0, 360), "polar"));
emitter.addInitialize(new Proton.Position(new Proton.RectZone(0, 0, canvas.width, canvas.height)));
var crossZoneBehaviour = new Proton.CrossZone(new Proton.RectZone(0, 0, canvas.width, canvas.height), "cross");
emitter.addBehaviour(crossZoneBehaviour);
emitter.addBehaviour(new Proton.Alpha(Proton.getSpan(0.35, 0.55)));
emitter.addBehaviour(new Proton.Color(this.getColor()));
emitter.addBehaviour(new Proton.RandomDrift(50, 50, 0.5));
emitter.emit("once");
this.proton.addEmitter(emitter);
var renderer = new Proton.CanvasRenderer(canvas);
this.proton.addRenderer(renderer);
this.crossZoneBehaviour = crossZoneBehaviour;
}
}, {
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"
);
emitter.addBehaviour(crossZoneBehaviour);
emitter.addBehaviour(new Proton.Alpha(Proton.getSpan(0.1, 0.55)));
emitter.addBehaviour(new Proton.Color(this.colors));
emitter.emit("once");
this.proton.addEmitter(emitter);
const renderer = this.createRenderer(canvas);
this.proton.addRenderer(renderer);
this.crossZoneBehaviour = crossZoneBehaviour;
emitter.preEmit(2);
}
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("#ffffff"));
this.crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, width, height),
"cross"
);
emitter.addBehaviour(this.crossZoneBehaviour);
emitter.emit("once");
emitter.damping = 0;
this.proton.addEmitter(emitter);
this.proton.addRenderer(this.createRenderer(canvas, emitter));
}
const createEmitter = (node, config = {}) => {
const emitter = new Proton.Emitter();
emitter.rate = config.num
? new Proton.Rate(Proton.getSpan(Math.floor(config.num * 0.7), config.num), 0.1)
: new Proton.Rate(Proton.getSpan(6, 8), 0.1);
const life = config.life ? new Proton.Life(config.life) : new Proton.Life(0.5, 1.2);
const color = config.color || getDefaultColor(node);
const tha = config.tha ? new Proton.Span(config.tha[0], config.tha[1]) : new Proton.Span(-30, 30);
const v = config.v ? new Proton.Span(config.v * 0.8, config.v) : new Proton.Span(0.6, 1.2);
if (config.alpha) {
if (Array.isArray(config.alpha)) {
emitter.addBehaviour(new Proton.Alpha(config.alpha[0], config.alpha[1]));
} else {
emitter.addBehaviour(new Proton.Alpha(config.alpha));
}
} else {
emitter.addBehaviour(new Proton.Alpha(Proton.getSpan(0.6, 0.9)));
}