本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: Awake
// Use this for initialization
void Awake () {
_Easing = GameObject.FindObjectOfType<Easing> ();
}
示例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);
}
}
示例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 ;
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例14: Start
// Use this for initialization
void Start () {
//どれかしらにアタッチしてある場合
easing = GameObject.FindObjectOfType<Easing> ();
//このスクリプトがアタッチされてるオブジェクトに
//Easing.csがアタッチされている場合
//easing = GetComponent<Easing>();
}
示例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);
}