本文整理匯總了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);
}