Click or drag to resize

MapAnimationExtensionsAnimateTPoint Method (IMapTPoint, FuncVector2, Single, Vector2, FuncVector2, Single, Vector2)

Animates this grid using a function animation that takes a point and time. The inverse animation is the inverse mapping at time t, that is,
inverseAmimation(animation(someVector, t), t) == someVector

Namespace:  Gamelogic.Grids
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static IMap<TPoint> Animate<TPoint>(
	this IMap<TPoint> map,
	Func<Vector2, float, Vector2> animation,
	Func<Vector2, float, Vector2> inverseAnimation
)
where TPoint : Object, IGridPoint<TPoint>

Parameters

map
Type: Gamelogic.GridsIMapTPoint
animation
Type: SystemFuncVector2, Single, Vector2
inverseAnimation
Type: SystemFuncVector2, Single, Vector2

Type Parameters

TPoint

Return Value

Type: IMapTPoint

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IMapTPoint. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
Example:
map = new PointyHexMap(hexDimensions).AnchorCellMiddleCenter()
    .WithWindow(ExampleUtils.ScreenRect)
    .AlignMiddleCenter(grid) 
//Rotate
    .Animate((x, t) => x.Rotate(45 * t), (x, t) => x.Rotate(-45 * t)) 
//Translate
    .Animate((x, t) => x + new Vector2(75 * Mathf.Sin(t * 5), 0),
        (x, t) => x - new Vector2(75 * Mathf.Sin(t * 5), 0)) 
//Scale
    .Animate((x, t) => x * (1 + Mathf.Sin(t * 7)),
         (x, t) => x / (1 + Mathf.Sin(t * 7)));
See Also