Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 : 150);
// Initialize
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(8));
emitter.addInitialize(
new Proton.V(new Proton.Span(0.1, 0.5), new Proton.Span(0, 360), "polar")
);
emitter.addInitialize(
new Proton.Position(
new Proton.CircleZone(canvas.width / 2, canvas.height / 2, 100)
)
);
// Behaviour
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
"cross"
);
emitter.addBehaviour(crossZoneBehaviour);
createProton(canvas, width, height) {
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.damping = 0.008;
emitter.rate = new Proton.Rate(150);
// Initialize
emitter.addInitialize(new Proton.Mass(1));
emitter.addInitialize(new Proton.Radius(8));
emitter.addInitialize(
new Proton.V(new Proton.Span(0.1, 0.5), new Proton.Span(0, 360), "polar")
);
emitter.addInitialize(
new Proton.Position(
new Proton.CircleZone(canvas.width / 2, canvas.height / 2, 100)
)
);
// Behaviour
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
"cross"
);
emitter.addBehaviour(crossZoneBehaviour);
createProton(canvas, width, height) {
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(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)
)
);
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
createProton(canvas, width, height) {
this.proton = new Proton();
const 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)
)
);
const crossZoneBehaviour = new Proton.CrossZone(
new Proton.RectZone(0, 0, canvas.width, canvas.height),
createProton(canvas, width, height) {
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(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)));
value: function createMiniEmitter(canvas) {
var miniEmitter = new Proton.Emitter();
miniEmitter.rate = new Proton.Rate(new Proton.Span(3, 6), new Proton.Span(1, 2));
miniEmitter.addInitialize(new Proton.Mass(1));
miniEmitter.radiusInitialize = new Proton.Radius();
miniEmitter.addInitialize(miniEmitter.radiusInitialize);
miniEmitter.addInitialize(new Proton.Life(0.5, 1));
miniEmitter.addInitialize(new Proton.V(new Proton.Span(1.5, 3), new Proton.Span(0, 70, true), "polar"));
miniEmitter.colorBehaviour = new Proton.Color("#ffffff");
miniEmitter.addBehaviour(new Proton.Alpha(1, 0));
miniEmitter.addBehaviour(miniEmitter.colorBehaviour);
miniEmitter.addBehaviour(new Proton.Gravity(4));
miniEmitter.addBehaviour(new Proton.Collision(miniEmitter));
miniEmitter.addBehaviour(new Proton.CrossZone(new Proton.RectZone(0, 0, canvas.width, canvas.height), "bound"));
this.proton.addEmitter(miniEmitter);
this.miniEmitter = miniEmitter;
}
}, {
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),
createProton(canvas, width, height) {
this.proton = new Proton();
const emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(
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)));