• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Animation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Animation的典型用法代码示例。如果您正苦于以下问题:C# Animation类的具体用法?C# Animation怎么用?C# Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Animation类属于命名空间,在下文中一共展示了Animation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnButton3Clicked

        void OnButton3Clicked(object sender, EventArgs args)
        {
            Button button = (Button)sender;

            // Create parent animation object.
            Animation parentAnimation = new Animation();

            // Create "up" animation and add to parent.
            Animation upAnimation = new Animation(
                v => button.Scale = v,
                1, 5, Easing.SpringIn,
                () => Debug.WriteLine("up finished"));

            parentAnimation.Add(0, 0.5, upAnimation);

            // Create "down" animation and add to parent.
            Animation downAnimation = new Animation(
                v => button.Scale = v,
                5, 1, Easing.SpringOut,
                () => Debug.WriteLine("down finished"));

            parentAnimation.Insert(0.5, 1, downAnimation);

            // Commit parent animation
            parentAnimation.Commit(
                this, "Animation3", 16, 5000, null,
                (v, c) => Debug.WriteLine("parent finished: {0} {1}", v, c));
        }
开发者ID:jenart,项目名称:xamarin-forms-book-preview-2,代码行数:28,代码来源:ConcurrentAnimationsPage.xaml.cs


示例2: Start

    //public GameObject _player;
    //public float _distance;
    // Use this for initialization
    void Start()
    {
        _animation = GetComponent<Animation> ();
        string _animationToPlay = _animationClip.name.ToString();

        //int animCount = _animation.GetClipCount(); // clip?! Unity people, why not state??
        //Debug.Log("Animations found: " + animCount );

        //_player = GameObject.FindGameObjectWithTag("Player");

        _animation[_animationToPlay].wrapMode = WrapMode.Loop;

        _animation.PlayQueued(_animationToPlay, QueueMode.CompleteOthers);

        //		foreach(AnimationState s in _animation) {
        //
        //			string theName = s.name.ToString();
        //			//_animation[theName].wrapMode = WrapMode.Once;
        //			_animation.PlayQueued(theName, QueueMode.CompleteOthers);
        //
        //
        //
        //		}
        //
    }
开发者ID:BGCX261,项目名称:zombie-ferox-svn-to-git,代码行数:28,代码来源:NPCanimate.cs


示例3: Start

	/// <summary>
	/// Find all idle animations.
	/// </summary>

	void Start ()
	{
		mAnim = GetComponentInChildren<Animation>();
		
		if (mAnim == null)
		{
			Debug.LogWarning(NGUITools.GetHierarchy(gameObject) + " has no Animation component");
			Destroy(this);
		}
		else
		{
			foreach (AnimationState state in mAnim)
			{
				if (state.clip.name == "idle")
				{
					state.layer = 0;
					mIdle = state.clip;
					mAnim.Play(mIdle.name);
				}
				else if (state.clip.name.StartsWith("idle"))
				{
					state.layer = 1;
					mBreaks.Add(state.clip);
				}
			}
		
			// No idle breaks found -- this script is unnecessary
			if (mBreaks.Count == 0) Destroy(this);
		}
	}
开发者ID:ziyihu,项目名称:TheWolfKillerU3D,代码行数:34,代码来源:PlayIdleAnimations.cs


示例4: coroutineAnimation

    public void coroutineAnimation(Animation a, CompleteDelegate completeDeletgate)
    {
        object[] parameters = new object[2]{a, completeDeletgate};

        StatusManager.enableNextOrder = false;
        StartCoroutine("animationWait",parameters);
    }
开发者ID:tomohitoei,项目名称:cureplusProto,代码行数:7,代码来源:SceneInit.cs


示例5: Start

 // Use this for initialization
 void Start()
 {
     anim = gameObject.GetComponent<Animation> ();
     sc = gameObject.GetComponent<SphereCollider> ();
     bc = gameObject.GetComponent<BoxCollider> ();
     initSound ();
 }
开发者ID:hanric,项目名称:runnerVJ,代码行数:8,代码来源:SpiderWorm.cs


示例6: setAnimationTypeAndValue

    /// <summary>
    /// Will set the Animation with the supplied parameter
    /// </summary>
    /// <param name="animation">The Animation to set</param>
    /// <param name="animator">The animator to get the Animations</param>
    /// <param name="parameter">The value for the Animation</param>
    public static void setAnimationTypeAndValue(Animation animation, Animator animator, object value)
    {
        if(value == null) {
            return;
        }

        //Grab what Type of parameter
        AnimatorControllerParameter param = getAnimatorControllerParameter(animation, animator);

        //If param doesn't exist, just get out
        if(param == null) {
            return;
        }

        switch(param.type) {
            case AnimatorControllerParameterType.Bool:
                animator.SetBool(animation.ToString(), (bool)value);
                break;
            case AnimatorControllerParameterType.Float:
                animator.SetFloat(animation.ToString(), (float)value);
                break;
            case AnimatorControllerParameterType.Int:
                animator.SetInteger(animation.ToString(), (int)value);
                break;
            case AnimatorControllerParameterType.Trigger:
                animator.SetTrigger(animation.ToString());
                break;
            default:
                break;
        }
    }
开发者ID:JeffreyGaither,项目名称:Games,代码行数:37,代码来源:AnimationMethods.cs


示例7: Start

    // Use this for initialization
    void Start()
    {
        anim = this.GetComponent<Animation> ();

        //		this.transform.position = Vector3.zero; // make sure the paddle is centered to the base
        //		this.transform.position += new Vector3 (0, startingYOffset, 0);// this will adjust the position to to below the base when the
    }
开发者ID:tensus2000,项目名称:Magnaball_1,代码行数:8,代码来源:Paddle.cs


示例8: Button1_Click

 protected void Button1_Click(object sender, EventArgs e)
 {
     Animation animation = new Animation();
     animation.Type = DropDownList1.SelectedValue;
     try
     {
         animation.Cascade = double.Parse(TextBox1.Text);
     }
     catch (Exception)
     {
         TextBox1.Text = "1";
         animation.Cascade = 1;
     }
     try
     {
         animation.Delay = double.Parse(TextBox2.Text);
     }
     catch (Exception)
     {
         TextBox2.Text = "0.5";
         animation.Delay = 0.5;
     }
     line1.OnShowAnimation = animation;
     OpenFlashChartControl1.Chart = chart;
 }
开发者ID:norain2050,项目名称:fanwei_xindai_3.2,代码行数:25,代码来源:LineAnimtion.aspx.cs


示例9: Start

    void Start()
    {
        animation = GetComponent<Animation>();
		_source = GetComponent<AudioSource>();

		_madeNoise = false;
    }
开发者ID:alecc08,项目名称:coldline-mtl,代码行数:7,代码来源:PlayerMovement.cs


示例10: Start

	void Start () {
	
		anim = GetComponent<Animation> ();
		death = false;

		enemies = 12;
	}
开发者ID:alecc08,项目名称:coldline-mtl,代码行数:7,代码来源:TonyBrendan.cs


示例11: Start

	void Start () 
    {
        player = GameObject.Find("Player");
        playerState = player.GetComponent<PlayerState>();
        ani = GetComponent<Animation>();
        ani.Play("Idle");
	}
开发者ID:YangJinwoo,项目名称:FPS,代码行数:7,代码来源:Spider.cs


示例12: Start

 public void Start () {
     anim = GetComponent<Animation>();
     animState = anim[anim.clip.name];
     // reset effects
     percent = 0;
     Sample();
 }
开发者ID:gaozhyu,项目名称:unity-ugui,代码行数:7,代码来源:ToggleSlider.cs


示例13: Start

 // Use this for initialization
 void Start()
 {
     // set animation
     this.animation = GetComponent<Animation> ();
     // set fire ligth
     this.fireLigth = this.effects.GetComponent<Light> ();
 }
开发者ID:leds-guarapari,项目名称:terravermelha,代码行数:8,代码来源:AnimationFPSControllerScript.cs


示例14: Start

 // Use this for initialization
 void Start()
 {
     m_Animation = GetComponent<Animation>();
     m_CurrentKeyState = Idle;
     m_StartPos = transform.position;
     m_TargetPos = m_StartPos;
 }
开发者ID:Gh0stBlade,项目名称:TR2-Level-Viewer,代码行数:8,代码来源:TRexStatePlayer.cs


示例15: Setup

 // If target or rigidbody are not set, try using fallbacks
 void Setup()
 {
     if (target == null)
     {
         target = GetComponent<Animation> ();
     }
 }
开发者ID:jiangkuo888,项目名称:ORP_beta,代码行数:8,代码来源:AnimationController.cs


示例16: AnimationInstance

 //  
 public AnimationInstance(Animation anim)
 {
   animation_ = anim;
   frameRate_ = anim.FrameRate;
   //  The time of the last frame is less than the duration of the animation,
   //  as the last frame has some duration itself.
   lastFrameTime_ = (anim.NumFrames - 1) / frameRate_;
   invFrameRate_ = 1.0f / frameRate_;
   duration_ = anim.NumFrames * invFrameRate_;
   int max = 0;
   //  calculate max bone index
   //  todo: do in content pipeline
   foreach (KeyValuePair<int, AnimationTrack> kvp in anim.Tracks)
   {
     if (kvp.Key >= max)
       max = kvp.Key + 1;
   }
   //  Allocate animation keyframes (for lerping between times).
   keyframes_ = new Keyframe[max];
   //  Load all the tracks (one track per bone).
   tracks_ = new AnimationTrack[max];
   foreach (int i in anim.Tracks.Keys)
   {
     keyframes_[i] = new Keyframe();
     tracks_[i] = anim.Tracks[i];
   }
 }
开发者ID:remmy925,项目名称:openbattlechess,代码行数:28,代码来源:AnimationInstance.cs


示例17: Start

	void Start()
	{
		if (Timer == null) Timer = GetComponent<CountdownTimer>();
		if (Timer == null) 
		{
			enabled = false;
			return;
		}
		
		if (Target == null) Target = animation;
		if (Target == null) 
		{
			enabled = false;
			return;
		}
		
		cl = animation.GetClip(AnimationName);
		if (cl == null) 
		{
			Debug.LogError("Animation " + AnimationName + " not found on object");
			return;
		}
		
		if (!Blend)
		{
			animation.Play(AnimationName);
		}
		else
		{
			animation.Blend(AnimationName, BlendWeight, 0f);
		}
		
		st = animation[AnimationName];
		st.speed = 0;
	}
开发者ID:badbod99,项目名称:unity3d-tuio,代码行数:35,代码来源:TimerAnimationPos.cs


示例18: Start

 void Start()
 {
     anim = GetComponent<Animation> ();
     navMap = gameObject.GetComponent<NavMeshAgent> ();
     MaxHealth = 100;
     Health = MaxHealth;
 }
开发者ID:GrahamMThomas,项目名称:Summer-Project-2015,代码行数:7,代码来源:Enemy.cs


示例19: Read

        protected override Asset Read(BinaryReader input)
        {
            String name = input.ReadString();
            Animation animation = new Animation(name);

            int framesCount = input.ReadInt32();

            AnimationFrame[] frames = new AnimationFrame[framesCount];
            for (int frameIndex = 0; frameIndex < frames.Length; ++frameIndex)
            {
                frames[frameIndex].x = input.ReadInt32();
                frames[frameIndex].y = input.ReadInt32();
                frames[frameIndex].ox = input.ReadInt32();
                frames[frameIndex].oy = input.ReadInt32();
                frames[frameIndex].w = input.ReadInt32();
                frames[frameIndex].h = input.ReadInt32();
                frames[frameIndex].duration = input.ReadInt32() * 0.001f;
            }

            animation.frames = frames;

            int textureSize = input.ReadInt32();
            byte[] data = input.ReadBytes(textureSize);

            using (MemoryStream stream = new MemoryStream(data))
            {
                Texture2D texture = Texture2D.FromStream(Runtime.graphicsDevice, stream);
                animation.texture = new TextureImage(texture);
            }

            return animation;
        }
开发者ID:bbqchickenrobot,项目名称:atomic-bomberman-xna,代码行数:32,代码来源:AnimationReader.cs


示例20: Awake

 // Use this for initialization
 void Awake()
 {
     CS = CharacterState.Idle;
     tr = GetComponent<Transform> ();
     ani = GameObject.Find ("Character1").GetComponent<Animation> ();
     GetComponent<Rigidbody> ().WakeUp ();
 }
开发者ID:Kimsanggu,项目名称:Maze,代码行数:8,代码来源:PlayerCtrl.cs



注:本文中的Animation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AnimationState类代码示例发布时间:2022-05-24
下一篇:
C# AnimatedSprite类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap