You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

aframe-asset-lazy-load

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-asset-lazy-load

Aframe component for delaying and prioritizing loading of assets.

1.0.0
latest
npm
Version published
Maintainers
1
Created
Source

NOTE: this project is not mine. I just published it to npm because I was needing it. I would gladly pass the ownership to the real maintainer.

There is an open issue for this, if you are the owner you can mention me there: https://github.com/youmustfight/aframe-asset-lazy-load/issues/8

aframe-asset-lazy-load-component

An a-entity component to assign asset loading order and delays

Usage

Install (or directly include the browser files).

npm install --save aframe-asset-lazy-load

Register

require('aframe');
var layout = require('aframe-layout').Component;
AFRAME.registerComponent('layout', layout);

Use with delays or chunks.

  <a-entity
    lazy-load="delay: 1000; src:../background.png; id: sphere1"
    geometry="primitive: sphere;
              radius: 200;"
    ></a-entity>
  <a-entity
    lazy-load="chunk: 0; src:../background2.png; id: sphere2"
    geometry="primitive: sphere;
              radius: 300;"
    ></a-entity>
  <a-entity
    lazy-load="chunk: 1; src:../background3.png; id: sphere3"
    geometry="primitive: sphere;
              radius: 100;"
    ></a-entity>
  <a-entity
    lazy-load="chunk: 1; id: sphere3"
    geometry="primitive: sphere;
              radius: 400;"
    ></a-entity>

Chunking is simply a way to block asset loading. For example, Let's say you have a game with a cinematic opening. Currently, you have to load all your assets at the start, meaning textures for the game are taking up bandwith you might want to use to get a user in the door. With chunking, you can set what is to be loaded immediately, via chunk 1, and what is to then be loaded upon those being completed, via chunk 2. This lets you spread out asset loading to make the immediate experience smoother.

Attributes

AttributeDescriptionDefault Value
delayMilliseconds waited until an image is appened to a-assets.0
chunkSlot an asset is placed in for loading. Multiple assets can be assigned to the same chunk. Over-rides delays
srcPath to the image being loaded
idThe ID being associated with the entity's material property and element in a-assets.

Keywords

aframe

FAQs

Package last updated on 04 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts