Greasy Fork is available in English.

FRHD Animator

Make FRHD animations easily

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/437014/998354/FRHD%20Animator.js

// ==UserScript==
// @name         FRHD Animator
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Make FRHD animations easily
// @author       1s3k3b
// @include      /^https?://(www.)?freeriderhd.com/create/
// @grant        none
// ==/UserScript==

(function main() {
    const lastHref = window.location.href;
    const reloadInv = setInterval(() => {
        if (lastHref !== window.location.href) {
            clearInterval(reloadInv);
            main();
        }
    }, 1000);
    if (!/^https?:\/\/(www\.)?freeriderhd\.com\/create/.test(window.location.href)) return;

    const topInv = setInterval(() => {
        const top = document.querySelector('.topMenu');
        if (!top) return;
        clearInterval(topInv);
        setInterval(() => {
            if (top.querySelector('#animate')) return;
            top.innerHTML += '<div class="topMenu-button topMenu-button_offline" title="New Frame" id="animate"><span class="editorgui_icons editorgui_icons-icon_offline_editor"></span><span class="text">Add Frame</span></div>';
            let x = 0;
            top.querySelector('#animate').onclick = () => {
                GameManager.game.currentScene.track.addPowerups([['W', ...[x, 30, x += 1000, 30].map(x => x.toString(32))].join(' ')]);
                for (const line of [...GameManager.game.currentScene.track.physicsLines]) {
                    if (!line.remove && line.p1.x < x && line.p1.x > (x - 1500)) GameManager.game.currentScene.track.addPhysicsLine(line.p1.x + 1000, line.p1.y, line.p2.x + 1000, line.p2.y);
                }
            };
        });
    });
})();