Skip to content

FloatMotion beta ​

TypeAlias of @v12-engine/client

ts
export type FloatMotion = 
/** World units up over the life */
{
    rise: number;
    ease?: FloatEase;
}
/** Sideways in screen pixels and up in world units, over the life */
 | {
    drift: {
        x: number;
        up?: number;
    };
    ease?: FloatEase;
}
/** Lobbed: sideways in pixels and up to `height` world units and down again, over the life */
 | {
    arc: {
        x: number;
        height: number;
    };
    ease?: FloatEase;
}
/** Its size from `from` to `to` times over `seconds`, then kept at `to` */
 | {
    pop: {
        from: number;
        to?: number;
        seconds: number;
        ease?: FloatEase;
    };
}
/** Bounces `times` times, `height` world units at first, lower each time, over `seconds` (the life when left out) */
 | {
    bounce: {
        height: number;
        times?: number;
        seconds?: number;
    };
}
/** Shakes `amount` pixels, less and less, over `seconds` */
 | {
    shake: {
        amount: number;
        seconds: number;
    };
}
/**
 * Its size times so much the whole life: a bigger number for a bigger hit, as a number, a function of what is
 * floated, or by the amount as data (`{ small: 10, big: 400, most: 1.6 }`, as `byAmount` does)
 */
 | {
    scaleBy: FloatValue<number> | FloatByAmount;
}
/** The game's own: given the time (0 to 1 of the life) and the float, says how far it is from where it started */
 | {
    custom: (t: number, at: FloatClock, input: FloatInput) => Partial<FloatPose>;
};

How a float moves: each a primitive with an ease over the float's life (or over its own seconds), or the game's own function of time. Several are added up (offsets) and multiplied (scale, opacity)