Minecraft data interpolation

Generate the path between a set of points and wrap the result into commands

by Mr Pingouin

HTML

<h2>Data Interpolation</h2>
        <div id="globalOption">
            <div>Command format : <input type="text" size="50" var-name="cmd_format" class="cmd-option" value='summon armor_stand {1} {2} {3} {NoAI:1b,Tags:["anim"],NoGravity:1b,Rotation:[{4}f,{5}f],ArmorItems:[{},{},{},{id:iron_helmet,Count:1b}]}'></div>
            <div>Input groups : <input type="text" var-name="val_types" class="cmd-option" value="pos pos pos rot rot"></div>
            <div>Delta time : <input type="text" var-name="dtime" var-parse="int" class="cmd-option" value="0"></div>
            <div>Steps : <input type="text" var-name="steps" var-parse="int" class="cmd-option" value="10"></div>
            <div>Time group : <input type="text" var-name="time_group" class="cmd-option"></div>
            <div>Smooth : <input type="text" var-name="smooth" var-parse="float" class="cmd-option" value="1"></div>
            <div>Define bias : <input type="checkbox" var-name="use_bias" class="cmd-option"></div>
            <div>Loop : <input type="checkbox" var-name="use_loop" class="cmd-option"></div>
            <div>Relative groups : <input type="text" var-name="relative_groups" class="cmd-option"></div>
               
            Data :
            <div style="inline-block;">
                <textarea var-name="cmd_base" class="cmd-option" placeholder="Coordinates" autofocus="autofocus" rows="10" cols="50">0 0 0 0 0
0 0 0 0 0</textarea><br>
                Output commands :
                <div id="ouputs">
                <!--<textarea id="end" placeholder="Commands compressed" readonly="readonly" rows="10" cols="50"></textarea>-->
                </div>
            </div>
            
        </div>
        <input type="submit" value="Generate" onclick='perform("normal")'>

JavaScript

/*
HOW TO USE :

    This tool can be used to generate position and rotation interpolations
    and wrap that into minecraft commands
    
    Just paste a list of space separated values.
    Each lines must contains the same number of space seperated value N
    The Input group field must contains at least N space separed keywords
    You need to provide at least 2 lines of data (or 4 if you checked the "define bias" option)
    
    Read up below about how all the options should be used :


    Command format
        The format of the command you want for your output
        Use {n} to insert the interpolation result into your command (starting at 1)
        {0} will always be the index of the command in the output (see delta time)
        
        Sample commands format along side their input group:
            
            summon armor_stand {1} {2} {3} {NoAI:1b,Tags:["anim"],NoGravity:1b}
            Input group : "pos pos pos"
            
            
            execute @a[score_anim_min={0},score_anim={0}] ~ ~ ~ tp @s {1} {2} {3} {4} {5}
            Input group : "pos pos pos rot rot"
            
            summon armor_stand {1} {2} {3} {NoAI:1b,Tags:["s"],NoGravity:1b,Rotation:[{4}f,{5}f]}
            Input group : "pos pos pos rot rot"
            
        
        
    Input groups
        Define a set of space separated custom group keyword (those group name can be anything, but it's recommended to stick with alphanumeric values)
        Each keyword describe the group of the column
        When multiple column are in the same group their interpolation will create smooth curves.
        It's recommanded to use a different group keyword for position and rotation
        
        Using this command format :
            summon armor_stand {1} {2} {3} {NoAI:1b,Tags:["anim"],NoGravity:1b,Rotation:[{4}f,{5}f]}
        
        We have to input at least 5 group keyword like so :
            pos pos pos rot rot
        
        And our data will have to...