Skip to content

Instantly share code, notes, and snippets.

@j-park-serori
Last active June 23, 2021 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-park-serori/37c0b116feff134c7923372a716ccc8a to your computer and use it in GitHub Desktop.
Save j-park-serori/37c0b116feff134c7923372a716ccc8a to your computer and use it in GitHub Desktop.
import { _decorator, Component, sp } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('SpineExample')
export class SpineExample extends Component {
@property({ type:sp.Skeleton })
skel: sp.Skeleton | null = null;
@property({ type:sp.Skeleton })
skel2: sp.Skeleton | null = null;
private _jitterEffect?:sp.VertexEffectDelegate;
start () {
this.skel?.setAnimation(0, "animation1", true);
console.log("path constraint's setting position in spine : " + this.skel?._skeleton.pathConstraints[0].position); // spineで入力したpositionの情報
if (this.skel?._skeleton.pathConstraints[0].position) // set positionの1番めの方法
{
this.skel._skeleton.pathConstraints[0].position = 0.4;
}
console.log("path constraint's 2nd position : " + this.skel?._skeleton.pathConstraints[0].position); // set positionの1番めの方法のpositionの情報
this.skel!._skeleton.pathConstraints[0].position = 0.2; // set positionの2番めの方法
console.log("path constraint's 3rd position : " + this.skel?._skeleton.pathConstraints[0].position); // set positionの2番めの方法のpositionの情報
}
// update () {
// }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment