Comments (6)
Sequence means running action by the order.
Spawn means running at the same time?
from pixi-action.
yes. cc. Spawn run at the same time.
I add class ActionSpawn like below but it's not work.
import Action from './Action';
export class Spawn extends Action {
constructor(actions) {
super();
this.actions = actions;
this.reset();
}
reset() {
// this._index = 0;
}
// if end return true, if not end return false
update(sprite, delta, deltaMS) {
if (!this.actions || !this.actions.length) {
return true;
}
let result = true;
for(var i = this.actions.length; i >=0;i--){
let action = this.actions[i];
let isEnd = action.update(sprite, delta, deltaMS);
if (isEnd) {
action.reset();
this.actions.splice(i,1);
}else{
result = false;
}
}
return result;
}
}
in index.js add
import {Spawn} from './ActionSpawn';
....
Spawn: Spawn,
from pixi-action.
What is the error message?
from pixi-action.
Uncaught TypeError: Cannot read property 'update' of undefined
at e.value (pixi-action.js:1)
at e.value (pixi-action.js:1)
at e.value (pixi-action.js:1)
at t.value (pixi-action.js:1)
i rebuild this plugin with comand
npm run build
i define some function like i use in cocos2dx
var cc = cc || {};
cc.moveTo= function( time, p)
{
return new PIXI.action.MoveTo(p.x, p.y, time);
};
cc.scaleTo= function( time, p)
{
return new PIXI.action.ScaleTo(p.x, p.y, time);
};
cc.sequence= function( )
{
return new PIXI.action.Sequence(arguments);//arguments is array
};
cc.spawn= function( )
{
return new PIXI.action.Spawn(arguments);//arguments is array
};
then i use spawn like this
var animTime= 1;
var move = cc.moveTo(animTime, {x: 100, y:100} );
var scale = cc.scaleTo(animTime, {x: 1, y:1});
var beforeMove = new PIXI.action.CallFunc(function() {
});
var afterMove = new PIXI.action.CallFunc(function() {
});
var action = cc.sequence(beforeMove, cc.spawn(move, scale),afterMove);
this.animation = PIXI.actionManager.runAction( this,action);
if i dont' use spawn, it work well.
Sorry for my bad english :(
from pixi-action.
i fix this in update function
for(var i = this.actions.length -1; i >=0;i--){
from pixi-action.
So you can send a pr.
from pixi-action.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixi-action.