Socket
Book a DemoInstallSign in
Socket

@vf.js/spine

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vf.js/spine

Spine implementation for vf v^5

latest
npmnpm
Version
2.1.22
Version published
Weekly downloads
0
-100%
Maintainers
4
Weekly downloads
 
Created
Source

vf-spine

Usage

import {Spine} from '@vf.js/spine';

Basic example

var app = new vf.Application();

document.body.appendChild(app.view);

Spine.globalAutoUpdate = true; // Spine的设置需在Loader之前。 不要移动位置。

app.loader.add('eddyData', './static/db/eddy.json') //shoot drive

app.loader.load(function (loader, resources) {
    
    const eddy = Spine.from(resources.eddyData,app);
    eddy.name = 'eddy';
    eddy.on(Spine.SPINE_START,(animationName:string)=>{
        console.log(Spine.SPINE_START,animationName);
    });
    eddy.on(Spine.SPINE_COMPLETE,(animationName:string)=>{
        console.log(Spine.SPINE_COMPLETE,animationName);
    });
    eddy.on(Spine.SPINE_EVENT,(animationName:string,event:vf.spine.core.Event)=>{
        console.log(Spine.SPINE_EVENT,animationName,event);
    });
    eddy.x = 500;
    eddy.y = 300;
    eddy.scale.set(0.1);
    eddy.timeScale(0.5);
    eddy.play('animationName'); //eddy.playQueue([{name:'shoot'},{name:'drive'}]);
    spineContainer.addChild(eddy);

});

基于数据创建 example

var app = new vf.Application();

document.body.appendChild(app.view);

app.loader.add('eddyData', './static/db/eddy.json') 
app.loader.add('eddAtlas', './static/db/eddy.atlas') 
app.loader.add('eddPng', './static/db/eddy.png')  

app.loader.load(function (loader, resources) {
    
    Spine.fromData(resources['eddyData'].data,resources['eddAtlas'].data,resources['eddPng'].texture as any,app,spine=>{
        spineContainer.addChild(spine)
    })
});

Building

npm install

FAQs

Package last updated on 24 Sep 2020

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