JSPM

vmd.js

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q29605F
  • License MIT

Read and edit mmd's vmd file

Package Exports

  • vmd.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vmd.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vmd.js

Load and modify your Mikumikudance vmd file with js!

Features

The Vmd file is a binary file. At present, it can only be edited by the mikumikudance.exe on windows.

Only javascript

read ArrayBuffer of the file, thanks

for the document of reading vmd file

Timeline

The object returned by vmd.js will add a timeline attribute, which can be used to view by FrameTime

Examples

Installation

npm i vmd.js
# or
yarn add vmd.js

Import it

import Vmd from'vmd.js'

// or

const Vmd = require('vmd')

Create vmd from file

fetch('test.vmd')
  .then(res => res.blob())
  .then(blob => blob.arrayBuffer())
  .then(arrayBuffer => new Vmd(arrayBuffer))

Export vmd as arrayBuffer

import {saveAs} from'file-saver'
const arrayBuffer = vmd.write()
    const url = URL.createObjectURL(new Blob([arrayBuffer]))
    saveAs(url,'your.vmd')

Some Attribute provided

VERSION

V1, V2 version string

BONE_NAME

The list of bone names in Japanese, like ['センター','upper body','头','头', ...]

BoneFrame

Bone frame

  • boneName
  • frameTime
  • translation
  • rotation
  • curveX
  • curveY
  • curveZ
  • curveR

MorphFrame

Emoticon frame

  • morphName
  • frameTime
  • weight

CameraFrame

Camera frame

  • frameTime
  • distance
  • position
  • rotation
  • curve
  • viewAngle
  • orthographic

LightFrame

Light frame

  • frameTime
  • rgb
  • direction

Vmd class

Contains all the data of the vmd file

Variable

  • version - version, there is V1 and V2

  • modelName - model name, have length limit

  • boneFrames - bone key frames

  • morphFrames - Emoji key frames

  • cameraFrames - camera key frames

  • lightFrames - light key frames

  • timeline - read-only variable, automatically sorted according to the key frame time{frameTime: number, boneFrames: BoneFrame[], morphFrames: MorphFrame[], cameraFrames: CameraFrame[], lightFrames: LightFrame[]}[]

Method

write

Regenerate the data into a binary file, you can export this ArrayBuffer as a file