game_actor_animation_track_position_track.js

import Vec2Track from "./vec2_track.js";

/**
 * @module PositionTrack
 * @fileoverview Contains PositionTrack class.
 */

/**
 * @class PositionTrack
 * @extends Vec2Track
 * Manipulates actor position over time.
 */
class PositionTrack extends Vec2Track {
    /**
     * Create a new position track.
     * @param {Object.<number, number|Vec2>} values Values at time intervals
     * @param {boolean} smooth Whether the track should start and end smoothly/gradually (false by default)
     * @constructor
     */
    constructor(values = {}, smooth = false) {
        super(values, smooth);
    }

    update(actor, progress) {
        actor.pos = this._gradient.get(progress);
    }
}

export default PositionTrack;