本文整理汇总了C#中Microsoft.Xna.Framework.Vector2.Rotate方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.Rotate方法的具体用法?C# Vector2.Rotate怎么用?C# Vector2.Rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Vector2
的用法示例。
在下文中一共展示了Vector2.Rotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public override void Start(Timeline t, Vector2 origin, Vector2 impulse)
{
base.Start(t, origin, impulse);
var size = (Rand.Between(.05f, .1f) * Force).Clamp(0, 5);
var l = (Rand.Between(-Radius, Radius) * Force / 50).Clamp(0, 2f);
var d = impulse.Rotate(MathKit.HalfPi, Vector2.Zero);
d.Normalize();
Velocity *= 2;
Alpha = 0;
Size = 0;
Color = BaseColor;
Width = 1;
Height = (Force / 20).Clamp(.1f, 2);
Position = origin + l * d;
Scale = Vector2.Zero;
var fadeOutTime = (size * .01f * Force).Clamp(0.1f, 1f);
t.RunInParallel(
new Tween(v => Scale = new Vector2(v, v), 0, size, .1f, Sine.EaseOut),
new Tween(v => Alpha = v, 0, 1, .1f, Sine.EaseOut))
.RunInParallel(
new Tween(v => Alpha = v, 1, 0, fadeOutTime, Sine.EaseOut),
new Tween(v => Scale = new Vector2(v, v), size, 0, fadeOutTime, Sine.EaseOut))
.Then(Dispose);
}