资源大湿 发表于 2013-3-7 16:51

NGUI控制Tween Scale实现动画效果

本帖最后由 小米 于 2013-3-30 21:17 编辑

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour
{
    public Transform tweenTarget;
    public float duration = 0.2f;
    public Vector3 a = new Vector3(0,0,0);
    public Vector3 b = new Vector3(200, 200, 0);
// Use this for initialization
void Start () {
      a =new Vector3(50, 50, 0);
      Vector3 b = new Vector3(200,200,0);
}

// Update is called once per frame
void Update () {
      
    }
    void Be()
    {
      TweenScale.Begin(tweenTarget.gameObject, duration, a);
    }
    void Be1()
    {
      TweenScale.Begin(tweenTarget.gameObject, duration, b);
    }
}

    public GameObject objPanelAvatarSetting;//对象
    public Vector3 a = new Vector3(1f, 1f, 1f);
    public Vector3 b = new Vector3(-2.204684e-05f, -213f, -76.05f);//声明

//实现代码利用scale 与position来实现动画
    objPanelAvatarSetting.gameObject.transform.localScale = new Vector3(0, 0, 0);
    TweenScale.Begin(objPanelAvatarSetting.gameObject, 0.5f, a);
   objPanelAvatarSetting.gameObject.transform.localPosition = new Vector3(-175.322f, 121.4104f, -76.05f);
   TweenPosition.Begin(objPanelAvatarSetting.gameObject,0.5f,b);

资源大湿 发表于 2013-3-9 16:54

本帖最后由 小米 于 2013-3-9 16:55 编辑

   IEnumerator ConScale(int temp)
    {

      TweenScale.Begin(GameObject.Find("Texture" + (temp + 1)), duration, b).method=UITweener.Method.BounceIn;

      yield return new WaitForSeconds(0.5f);
      TweenScale.Begin(GameObject.Find("Texture" + (temp + 1)), duration, a).method = UITweener.Method.BounceIn;
    }
此为调用NGUI自带动画代码

资源大湿 发表于 2013-3-9 17:26

华为网盘附件:
【华为网盘】 TweenScale.unitypackage

animan 发表于 2013-3-10 08:27

谢谢分享。。。。。。

likunhan 发表于 2013-4-8 17:32

感谢!正需要,研究研究。

kelvinhuang 发表于 2013-4-23 02:16


感谢楼主的无私分享!{:soso__11402694654016840197_7:}

jerry6084 发表于 2013-5-6 23:15


感谢楼主的无私分享!{:soso__11402694654016840197_7:}

tiamwan 发表于 2017-2-13 22:58

很不错

tiamwan 发表于 2017-2-13 22:20

好帖就是要顶

tiamwan 发表于 2017-2-13 22:03

顶顶多好
页: [1]
查看完整版本: NGUI控制Tween Scale实现动画效果