How to use async-preloader - 2 common examples

To help you get started, we’ve selected a few async-preloader 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 dmnsgn / primitive-geometry / demo / index.js View on Github external
const Primitives = require("../");
const AsyncPreloader = require("async-preloader").default;
const createCamera = require("perspective-camera");
const createOrbitControls = require("orbit-controls");
const dat = require("dat.gui");
const triangulate = require("geom-triangulate");

const createMesh = require("./mesh.js");
const regl = require("./context.js");

// Setup
const camera = createCamera({
  fov: Math.PI / 4,
  near: 0.1,
  far: 100,
  viewport: [0, 0, window.innerWidth, window.innerHeight]
});
const controls = createOrbitControls({
github dmnsgn / primitive-geometry / demo / index.js View on Github external
async function loadTexture(src) {
  const image = await AsyncPreloader.loadImage({ src });

  const texture = regl.texture({ data: image, flipY: false });
  texture.resize(image.width, image.height);

  return texture;
}

async-preloader

Assets preloader using async/await and fetch for usage both in the browser and Node.js.

MIT
Latest version published 6 months ago

Package Health Score

62 / 100
Full package analysis