How to use the proton-engine.MathUtil function in proton-engine

To help you get started, we’ve selected a few proton-engine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lindelof / particles-bg / src / particles / Square.jsx View on Github external
renderer.onParticleCreated = particle => {
      const w = particle.radius || 60;
      const h = Proton.MathUtil.randomAToB(100, 200, "int");
      particle.data.w = w;
      particle.data.h = h;
    };
github lindelof / particles-bg / src / particles / Thick.jsx View on Github external
renderer.onParticleCreated = particle => {
      particle.data.begin = Proton.MathUtil.randomAToB(1, 120);
      particle.data.tha = Proton.MathUtil.randomAToB(0, Math.PI * 2);
    };
github lindelof / particles-bg / dist / index.es.js View on Github external
renderer.onParticleCreated = function (particle) {
        particle.data.begin = Proton.MathUtil.randomAToB(1, 120);
        particle.data.tha = Proton.MathUtil.randomAToB(0, Math.PI * 2);
      };
github drawcall / Proton / source / src / components / particles / Thick.jsx View on Github external
renderer.onParticleCreated = particle => {
      particle.data.begin = Proton.MathUtil.randomAToB(1, 120);
      particle.data.tha = Proton.MathUtil.randomAToB(0, Math.PI * 2);
    };
github lindelof / particles-bg / src / particles / Polygon.jsx View on Github external
renderer.onParticleUpdate = particle => {
      context.save();
      context.globalAlpha = particle.alpha;
      context.fillStyle = particle.color;

      context.translate(particle.p.x, particle.p.y);
      context.rotate(Proton.MathUtil.degreeTransform(particle.rotation));
      context.translate(-particle.p.x, -particle.p.y);

      context.beginPath();
      drawPolygon(particle, particle.data.count);

      context.closePath();
      context.fill();
      context.globalAlpha = 1;
      context.restore();
    };
github lindelof / particles-bg / src / particles / Polygon.jsx View on Github external
renderer.onParticleCreated = particle => {
      particle.data.count = Proton.MathUtil.randomAToB(3, 10, true);
    };
github lindelof / particles-bg / dist / index.es.js View on Github external
renderer.onParticleCreated = function (particle) {
        var w = particle.radius || 60;
        var h = Proton.MathUtil.randomAToB(100, 200, "int");
        particle.data.w = w;
        particle.data.h = h;
      };
github lindelof / particles-bg / src / particles / Square.jsx View on Github external
renderer.onParticleUpdate = particle => {
      const w = particle.data.w;
      const h = particle.data.h;
      context.save();
      context.globalAlpha = particle.alpha;
      context.fillStyle = particle.color;

      context.translate(particle.p.x, particle.p.y);
      context.rotate(Proton.MathUtil.degreeTransform(particle.rotation));
      context.translate(-particle.p.x, -particle.p.y);

      context.beginPath();
      context.rect(particle.p.x - w / 2, particle.p.y - h / 2, w, h);

      context.closePath();
      context.fill();
      context.globalAlpha = 1;
      context.restore();
    };