How to use the @vuesion/utils/dist/randomGenerator.getFloatInRange function in @vuesion/utils

To help you get started, we’ve selected a few @vuesion/utils 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 vuesion / vuesion / src / app / shared / animations / CircleAnimation.ts View on Github external
const getCircles = (
  circleCount: number,
  canvas: HTMLCanvasElement | any,
  context: CanvasRenderingContext2D | any,
): Circle[] => {
  const localCircles: any[] = [];

  for (let i = 0; i < circleCount; i++) {
    localCircles.push(
      new Circle(
        context,
        getIntInRange(50, 350),
        getFloatInRange(0.1, 1),
        getFloatInRange(2, 10),
        getIntInRange(0, canvas.width),
        getIntInRange(0, canvas.height),
      ),
    );
  }

  return localCircles;
};
github vuesion / vuesion / src / app / shared / animations / CircleAnimation.ts View on Github external
const getCircles = (
  circleCount: number,
  canvas: HTMLCanvasElement | any,
  context: CanvasRenderingContext2D | any,
): Circle[] => {
  const localCircles: any[] = [];

  for (let i = 0; i < circleCount; i++) {
    localCircles.push(
      new Circle(
        context,
        getIntInRange(50, 350),
        getFloatInRange(0.1, 1),
        getFloatInRange(2, 10),
        getIntInRange(0, canvas.width),
        getIntInRange(0, canvas.height),
      ),
    );
  }

  return localCircles;
};
github vuesion / vuesion / src / app / shared / animations / CircleAnimation.ts View on Github external
this.xPos + Math.cos(this.counter / 100) * this.radius,
      this.yPos + Math.sin(this.counter / 100) * this.radius,
      this.width,
      0,
      Math.PI * 2,
      false,
    );

    this.context.closePath();

    this.context.fillStyle = 'rgba(244, 59, 108,' + this.opacity + ')';
    this.context.fill();

    if (this.opacity <= 0) {
      this.counter = 0;
      this.opacity = getFloatInRange(0.05, 0.9);
      this.width = getIntInRange(2, 10);
      this.speed = getFloatInRange(0.1, 1);
    }
  }
}
github vuesion / vuesion / src / app / shared / animations / CircleAnimation.ts View on Github external
import { getFloatInRange, getIntInRange } from '@vuesion/utils/dist/randomGenerator';

class Circle {
  private opacity: number = getFloatInRange(0.05, 0.9);
  private counter: number = 0;
  private direction: number = 0;

  constructor(
    private context: CanvasRenderingContext2D | any,
    private radius: number,
    private speed: number,
    private width: number,
    private xPos: number,
    private yPos: number,
  ) {
    this.direction = getIntInRange(0, 1) === 1 ? -1 : 1;
  }

  public update(): void {
    this.counter += this.direction * this.speed;
github vuesion / vuesion / src / app / shared / animations / CircleAnimation.ts View on Github external
this.width,
      0,
      Math.PI * 2,
      false,
    );

    this.context.closePath();

    this.context.fillStyle = 'rgba(244, 59, 108,' + this.opacity + ')';
    this.context.fill();

    if (this.opacity <= 0) {
      this.counter = 0;
      this.opacity = getFloatInRange(0.05, 0.9);
      this.width = getIntInRange(2, 10);
      this.speed = getFloatInRange(0.1, 1);
    }
  }
}

@vuesion/utils

utilities for vuesion

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis