当前位置: 首页>>代码示例>>C#>>正文


C# Easing类代码示例

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


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

示例1: TranslateXTo

        public static Task<bool> TranslateXTo(this VisualElement view, double x, 
                                              uint length = 250, Easing easing = null) 
        { 
            easing = easing ?? Easing.Linear; 
 	        TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
            WeakReference<VisualElement> weakViewRef = new WeakReference<VisualElement>(view);

            Animation animation = new Animation(
                (value) => 
                    {
                        VisualElement viewRef;
                        if (weakViewRef.TryGetTarget(out viewRef))
                        {
                            viewRef.TranslationX = value;
                        }
                    },              // callback
                view.TranslationX,  // start
                x,                  // end
                easing);            // easing

            animation.Commit(
                view,               // owner
                "TranslateXTo",     // name
                16,                 // rate
                length,             // length
                null,               // easing 
                (finalValue, cancelled) => 
                        taskCompletionSource.SetResult(cancelled)); // finished
 			 
 	        return taskCompletionSource.Task; 
        } 
开发者ID:xia101,项目名称:xamarin-forms-book-samples,代码行数:31,代码来源:MoreViewExtensions.cs

示例2: BuildSpikes

    IEnumerator BuildSpikes()
    {
        Vector3[] verts = GetSpikes();
        int num = verts.Length;

        Easing[] easers = new Easing[num];

        for(int i = 0; i < num; i++)
        {
            easers[i] = new Easing(Easing.EaseType.Back, originalVerts[i], verts[i], 10);
        }

        yield return null;

        while(!easers[0].finished)
        {
            Vector3[] temp = new Vector3[num];

            for(int i = 0; i < num; i++)
            {
                temp[i] = easers[i].Vector3;
            }

            mesh.vertices = temp;
            mesh.RecalculateNormals();
            yield return null;
        }
        yield return null;
    }
开发者ID:GirishBala,项目名称:unity-kickstarter-vis,代码行数:29,代码来源:SpikeBall.cs

示例3: LayoutTo

		public static Task<bool> LayoutTo(this VisualElement view, Rectangle bounds, uint length = 250, Easing easing = null)
		{
			if (view == null)
				throw new ArgumentNullException("view");
			if (easing == null)
				easing = Easing.Linear;

			var tcs = new TaskCompletionSource<bool>();
			Rectangle start = view.Bounds;
			Func<double, Rectangle> computeBounds = progress =>
			{
				double x = start.X + (bounds.X - start.X) * progress;
				double y = start.Y + (bounds.Y - start.Y) * progress;
				double w = start.Width + (bounds.Width - start.Width) * progress;
				double h = start.Height + (bounds.Height - start.Height) * progress;

				return new Rectangle(x, y, w, h);
			};
			var weakView = new WeakReference<VisualElement>(view);
			Action<double> layout = f =>
			{
				VisualElement v;
				if (weakView.TryGetTarget(out v))
					v.Layout(computeBounds(f));
			};
			new Animation(layout, 0, 1, easing).Commit(view, "LayoutTo", 16, length, finished: (f, a) => tcs.SetResult(a));

			return tcs.Task;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:29,代码来源:ViewExtensions.cs

示例4: Awake

	// Use this for initialization
	void Awake () {

		_Easing = GameObject.FindObjectOfType<Easing> ();



	}
开发者ID:wem-wem,项目名称:WonderfulShopping,代码行数:8,代码来源:ChangeFatBob.cs

示例5: _TestComposeRange

 private void _TestComposeRange (int [] values, Easing easing)
 {
     for (double i = 0, n = 100, p = 0, j = 0; i <= n; i += 5, p = i / n, j++) {
         int value = Choreographer.PixelCompose (p, (int)n, easing);
         Assert.AreEqual (values[(int)j], value);
     }
 }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:7,代码来源:ChoreographerTests.cs

示例6: TweenCreationSettings_old

 public TweenCreationSettings_old( Type type, Easing easing, float from, float to, TimeSpan duration )
 {
     From = @from ;
     To = to ;
     Type = type ;
     Easing = easing ;
     Duration = duration ;
 }
开发者ID:mtgattie,项目名称:Gleed2D,代码行数:8,代码来源:TweenCreationSettings.cs

示例7: Start

	// Use this for initialization
	void Start () {
		timer = 0;
		_easing = GameObject.FindObjectOfType<Easing>();
		_camera = GameObject.FindObjectOfType<ChangeCamera> ();
		//StartCoroutine (RandomShake(_camera.CurrentCamera));
		//StartCoroutine(SlideIn(5.0f,_camera.CurrentCamera,true));
		//StartCoroutine (R_HighFromCameraToTaget(3.0f,_camera.CurrentCamera));
	}
开发者ID:wem-wem,项目名称:WonderfulShopping,代码行数:9,代码来源:CameraAnimator.cs

示例8: ProgressTo

		public Task<bool> ProgressTo(double value, uint length, Easing easing)
		{
			var tcs = new TaskCompletionSource<bool>();

			this.Animate("Progress", d => Progress = d, Progress, value, length: length, easing: easing, finished: (d, finished) => tcs.SetResult(finished));

			return tcs.Task;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:8,代码来源:ProgressBar.cs

示例9: Animation

		public Animation (IAnimationDrawer drawer, uint duration, Easing easing, Blocking blocking)
		{
			this.Drawer = drawer;
			this.Duration = duration;
			this.Easing = easing;
			this.Blocking = blocking;
			this.AnimationState = AnimationState.Coming;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:8,代码来源:Animation.cs

示例10: Action

 public static LNEase Action(Easing e, LNAction act)
 {
     LNEase action = new LNEase();
     action._duration = act._duration;
     action._action = act;
     act._easing = e;
     return action;
 }
开发者ID:keppelcao,项目名称:LGame,代码行数:8,代码来源:LNEase.cs

示例11: ColorAnimation

		static Task<bool> ColorAnimation(VisualElement element, string name, Func<double, Color> transform, Action<Color> callback, uint length, Easing easing)
		{
			easing = easing ?? Easing.Linear;
			var taskCompletionSource = new TaskCompletionSource<bool>();

			element.Animate<Color>(name, transform, callback, 16, length, easing, (v, c) => taskCompletionSource.SetResult(c));
			return taskCompletionSource.Task;
		}
开发者ID:RickySan65,项目名称:xamarin-forms-samples,代码行数:8,代码来源:ViewExtensions.cs

示例12: Animate

        public static ContextOperation<TimeSpan> Animate(this IGameContext context, TimeSpan duration, float startValue, float endValue, Action<float> valueStep, CancellationToken cancellationToken = default(CancellationToken), Easing easing = null)
        {
            var info = new FloatAnimation(duration, startValue, endValue, valueStep, easing);

            if (cancellationToken != default(CancellationToken))
                cancellationToken.Register(info.Cancel);

            return context.Run(info);
        }
开发者ID:powerdude,项目名称:xamarin-forms-xna,代码行数:9,代码来源:AnimationExtensions.cs

示例13: ColorTo

		public static Task<bool> ColorTo(this VisualElement self, Color fromColor, Color toColor, Action<Color> callback, uint length = 250, Easing easing = null)
		{
			Func<double, Color> transform = (t) =>
				Color.FromRgba(fromColor.R + t * (toColor.R - fromColor.R),
							   fromColor.G + t * (toColor.G - fromColor.G),
							   fromColor.B + t * (toColor.B - fromColor.B),
							   fromColor.A + t * (toColor.A - fromColor.A));
			return ColorAnimation(self, "ColorTo", transform, callback, length, easing);
		}
开发者ID:RickySan65,项目名称:xamarin-forms-samples,代码行数:9,代码来源:ViewExtensions.cs

示例14: Start

	// Use this for initialization
	void Start () {

		//どれかしらにアタッチしてある場合
		easing = GameObject.FindObjectOfType<Easing> ();
		//このスクリプトがアタッチされてるオブジェクトに
		//Easing.csがアタッチされている場合
		//easing = GetComponent<Easing>();


	}
开发者ID:wem-wem,项目名称:WonderfulShopping,代码行数:11,代码来源:EasinSample.cs

示例15: XTween

 //Tween Constructor Not Set FromValue
 public XTween(object target, string property = null, double to = 0, double duration = 0, Easing easing = Easing.EaseNoneInOut, double delay = 0)
 {
     target_ = target;
     SetProperties(property);
     ClearFrom();
     SetTo(to);
     SetDuration(duration);
     SetEasingFunction(easing);
     SetDelay(delay);
 }
开发者ID:xlune,项目名称:XTween,代码行数:11,代码来源:XTween.cs


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