獲取spine動畫的一些資訊

2021-07-27 13:40:37 字數 3755 閱讀 2332

//skeletondata

skeletonanimation skeletonanimation = getcomponent();

debug.log(skeletonanimation.name);//獲取角色名

debug.log(skeletonanimation.skeleton.bones[5].tostring()); //獲取所有骨骼陣列list

debug.log(skeletonanimation.skeleton.slots[5].tostring());//獲取所有插槽數組

debug.log(skeletonanimation.skeleton.data.animations[0].name.tostring());//獲取所有動畫陣列

skeletonanimation.skeleton.findbone("root").flipx = true;//根據骨骼名獲取骨骼

debug.log(skeletonanimation.skeleton.findboneindex("root").tostring());//根據骨骼名獲取骨骼的index

debug.log(skeletonanimation.skeleton.findslot("torso").attachment.name);//根據slot名獲取slot

debug.log(skeletonanimation.skeleton.findslotindex("torso").tostring());//根據slot名獲取slot index

debug.log(skeletonanimation.skeleton.data.findanimation("walk").name);//根據動畫名獲取動畫

//skin

debug.log(skeletonanimation.skeleton.data.skins[0].name.tostring());//獲取所有 skin

spine.attachment _attachment = skeletonanimation.skeleton.data.skins[0].getattachment(5,"left lower leg");//從skin通過slot的index attachment的名獲取attachment

//bonedata

spine.bone _bone = skeletonanimation.skeleton.findbone("left upper leg");

debug.log(_bone.parent.tostring());//獲取骨骼的父骨骼

debug.log(_bone.data.length.tostring());//獲取骨骼長度

debug.log(_bone.rotation.tostring());//獲取骨骼旋轉

debug.log(_bone.data.scalex.tostring());//獲取骨骼放縮

debug.log(_bone.data.scaley.tostring());

debug.log(_bone.data.inheritrotation.tostring());// 是否旋轉值相對父骨骼 true是相對父骨骼

debug.log(_bone.data.inheritscale.tostring());//是否放縮值相對父骨骼 true是相對父骨骼

//slotdata

spine.slot _slot = skeletonanimation.skeleton.findslot("torso");

debug.log(_slot.data.name);//獲取slot的名字

debug.log(_slot.data.bonedata.name);//獲取slot掛靠的bone

debug.log(_slot.r.tostring());//獲取slot的顏色r值

debug.log(_slot.data.attachmentname);//獲取pose下slot的attachment名

_slot.data.additiveblending = true;//獲取或設定slot時候用additive blending來渲染 注釋:用於特效?

//animation

debug.log(skeletonanimation.skeleton.data.animations[0].duration.tostring());//動畫持續時間?

list_timeline = skeletonanimation.skeleton.data.animations[0].timelines;//獲取動畫timeline

//skeleton

spine.skeletondata _data = skeletonanimation.skeleton.data;//獲取skeletondata

debug.log(_data.bones[0].tostring()); //獲取所有骨骼

debug.log(_data.slots[0].tostring());//獲取所有slots

debug.log(skeletonanimation.skeleton.draworder[0].attachment.name);//獲取所有drawoder

debug.log(skeletonanimation.skeleton.skin.name);//獲取當前skin名

skeletonanimation.skeleton.r = 0.5f;//對skin的整體偏色 有rgba四個引數

debug.log(skeletonanimation.skeleton.time.tostring());//?

skeletonanimation.skeleton.flipx = true;//skeleton翻轉軸向

skeletonanimation.skeleton.flipy = true;

skeletonanimation.skeleton.x = 0;//skeleton的座標

skeletonanimation.skeleton.y = 0;

skeletonanimation.skeleton.setbonestosetuppose();

skeletonanimation.skeleton.setslotstosetuppose();

skeletonanimation.skeleton.settosetuppose();

獲取getattachment

skeletonanimation.skeleton.update(0.5f);//??

}--換裝函式,但是必須在slot裡有這個attachment名

skeletonanimation = getcomponent();

skeletonanimation.skeleton.setattachment("rear_upper_arm","muzzle");

skeletonanimation.skeleton.getattachment();

--動畫翻轉

if(x > 0)

skeletonanimation.skeleton.flipx = false;

else if(x < 0)

skeletonanimation.skeleton.flipx = true;

skeletonanimation.state.setanimation(0, hitanimation, false);

skeletonanimation.state.addanimation(0, currentanimation, true, 0);

注:(起始幀,動畫名,是否loop)

//角色之間的繪製排序

renderer.sortingorder = -5;

Android獲取一些常用資訊

獲取版本號和版本名 packagemanager pm context.getpackagemanager packageinfo pi pm.getpackageinfo context.getpackagename 0 versionname pi.versionname versioncode...

獲取手機一些系統資訊的一些工具類

public class datautil else if page 1 frame null return true 資料獲得後的檢查 資料的error值,是否有資料,有些資料是根據時間值來做分頁的 param context param data param frame param time r...

JS獲取URL資訊的一些收集

thisdloc document.location thisurl document.url thishref document.location.href thissloc self.location.href thistloc top.location.href thisploc parent...