npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aw-sequence-parser

v0.4.2

Published

Javascript parser for Active Worlds (AW) sequence files

Downloads

102

Readme

aw-sequence-parser

Javascript parser for Active Worlds (AW) sequence files

Usage

The parseSequence function expects two parameters:

  • uri: mandatory, pointing to the resource (the url of some AW .zip sequence file for example)
  • 'opts': optional, set of options to provide to the parser.

If nothing is provided, opts will hold the following values:

{
  fileType: FileType.AUTO, // Auto detect file type (WIP)
  fflate: null,            // fflate module, mandatory to extract zipped sequences
  cors: false              // Set to 'true' to enable CORS policy on http(s) request
}

In practice: it's highly recommended to provide such opts dictionary with fflate set, as zipped binary sequence files are usually the default way to go for AW object paths.

parseSequence will return the Promise of a dictionary for the freshly-parsed sequence file:

{
  "fileType": "binary",             // The type of file this was extracted from, binary files are meant to be 30fps animations
  "totalNFrames": 413,              // Total number of frames for this animation
  "nJoints": 27,                    // Number of joints involved in this animation
  "modelName": "lmarsha",           // Name of the 3D model the sequence was meant to apply to, as an hint
  "rootJointName": "pelvis",        // Name of the root joint to apply translations to
  "frames": {                       // Key frames held in a dictionary (indices starting from 1)
    "1": {
      "joints": {
        "pelvis": [qX, qY, qZ, qW], // Quaternion parameters for each joint in the frame
        "back":  [qX, qY, qZ, qW],
        ...
      },
      "location": [x, y, z]         // Translation to apply to the root joint for this frame
    },
    "3": {
      "joints": {
        "pelvis": [qX, qY, qZ, qW],
        "back":  [qX, qY, qZ, qW],
        ...
      },
      "location": [x, y, z]
    },
    ...
  }
}

Note that the number of provided key-frames will often differ from totalNFrames: those missing frames are meant to be interpolated later on by the actual client making use of this parser.

Getting RWX joint tags

Joint tag numbers, as specified in RWX clumps from avatar models, can be fetched from joint names by importing and using getJointTag(jointName); (where jointName can be something like 'pelvis', 'back', etc...), it is meant to be case-insensitive.

If the joint name is invalid: it will return undefined.

Example

import parseSequence, {FileType, getJointTag} from 'aw-sequence-parser';
import * as fflate from 'fflate';

walkSeqPath = 'http://objects.activeworlds.com/uberpath/seqs/walk.zip';

const seqPromise = parseSequence(walkSeqPath, { fileType: FileType.AUTO,
                                                fflate,
                                                core: true });

seqPromise.then( seq => { /* Handle sequence here */ });

const pelvisTag = getJointTag('pelvis'); // 1
const lfkneeTag = getJointTag('LFKNEE'); // 20
const invalidTag = getJointTag('I do not exist'); // undefined

Testing

$ npm test

Linting

$ npm run lint

References

  • http://www.imatowns.com/xelagot/seqspecs.html