MeatMotion

RoundingMode

Select the rounding direction for integer tweens. The default ToEven rounds midpoint ties to an even integer.

Namespace
MeatMotion
Assembly
MeatMotion

Jump to members

public enum RoundingMode : byte
IntegerOptions.cs · L5

Truncate an integer counter

Add using MeatMotion;. Halfway from 0 to 5 the interpolated value is 2.5. ToZero writes 2 to the counter.

int counter = 0;
using var world = new MotionWorld();
MMotion.Create(0, 5, 1f).WithRoundingMode(RoundingMode.ToZero)
    .WithScheduler(world).Bind(v => counter = v);
world.Tick(0.5);

Members

ToEven

Round to the nearest integer and choose even at a midpoint.

AwayFromZero

Round fractional values away from zero, upward for positive values and downward for negative ones.

ToZero

Discard the fractional part toward zero.

ToPositiveInfinity

Round upward toward positive infinity.

ToPositiveInfinity

ToNegativeInfinity

Round downward toward negative infinity.

ToNegativeInfinity