1 // 通过clip名称获取clip实例
2 tk2dSpriteAnimationClip clip = childrenAnimator.GetClipByName("J1_Idle");
3 // 通过clip实例的frames成员得到第一帧对象tk2dSpriteAnimationFrame
4 tk2dSpriteAnimationFrame firstFrame = clip.frames[0];
5 // 通过tk2dSpriteAnimationFrame的spriteCollection成员得到tk2dSpriteCollectionData对象
6 // 通过tk2dSpriteAnimationFrame的spriteId成员得到frame对应的sprite的Id
7 childrenAnimator.SetSprite(firstFrame.spriteCollection, firstFrame.spriteId);
- 通过Animation名称指定Animator的Library
1 var _ins_animation = Resources.Load<tk2dSpriteAnimation>("JA 1");
2 foreach (var c in _ins_animation.clips) ZSLoger.Instance.Loger.DebugFormat("clip in _ins_animation clips = {0}", c.name);
3 ZSLoger.Instance.Loger.DebugFormat("use tk2dSystem init tk2dSpriteAnimation prefab that name is 'JA', then object name = {0}", _ins_animation.name);
4 childrenAnimator.Library = _ins_animation;