MZ [CONVERSION] Mosaic Effect Transfer (Pixelated Transition)

Hello everyone,

I fell in love with the map transition by Mikagami Atelier presented in this thread, which reminds me of FF6 and which I would absolutely like to implement in my game.

It's a "mosaic" transition, where the pixels on the screen slowly grow larger before shrinking to reveal the new screen.
I've seen that Hakuen Studio offers a version of a similar effect, but this one is rougher, faster and cuts to black at the end. In short, it hurts the eyes a little more. I'd really like to recapture the smoothness of Mikagami Atelier's version.

pixt-min.gif


That's why I'm looking for someone willing to try and adapt this script into a working plugin for RPG Maker MZ.
Unfortunately, as my javascript skills are nil, I can't take on this project myself...

Thanks in advance for any help you can give me.
Try this (Untested):
JavaScript:
//==============================================================================
/**
 * Mosaic Effect Transfer
 * Ver 0.01 2022/04/22
 * http://fweb.midi.co.jp/~mikagami/atelier/
 */
//==============================================================================

class Game_Temp {
    constructor() {
        this.clear();
    }

    clear() {
        this.fadeType2 = 0;  // Clear
    }

    mosaic() {
        this.fadeType2 = 1;  // Mosaic effect
    }

    isMosaic() {
        return this.fadeType2 === 1;  // Is Mosaic?
    }

    isActive() {
        this.fadeType2 = this.fadeType2 || 0;
        return this.fadeType2 >= 1;  // Is active?
    }
}

class Scene_Map extends Scene_Base {
    preTransfer() {
        this._mapNameWindow.close();
        if ($gameTemp.isActive()) {
            this.mosaicOut();
        } else {
            switch ($gameTemp.fadeType) {
                case 0:
                    this.fadeOut(this.fadeOutSpeed());
                    break;
                case 1:
                    this.whiteFadeOut(this.fadeOutSpeed());
                    break;
            }
        }
    }

    postTransfer() {
        if ($gameTemp.isActive()) {
            this.updateForFade();
            this.mosaicIn();
            $gameTemp.clear();
        } else {
            switch ($gameTemp.fadeType) {
                case 0:
                    this.wait(this.fadeInSpeed() / 2);
                    this.fadeIn(this.fadeInSpeed());
                    break;
                case 1:
                    this.wait(this.fadeInSpeed() / 2);
                    this.whiteFadeIn(this.fadeInSpeed());
                    break;
            }
        }
        this._mapNameWindow.open();
    }

    // Mosaic screen in
    mosaicIn(duration = 2) {
        Graphics.brightness = 255;
        const bmps = this.createMosaicBitmapArray();
        const sprite = new Sprite();
        sprite.z = 255;
        sprite.bitmap = new Bitmap(Graphics.width, Graphics.height);
        for (let i = 0; i < 16; i++) {
            sprite.bitmap.stretchBlt(sprite.bitmap.rect, bmps[15 - i], bmps[15 - i].rect);
            sprite.setColor(0, 0, 0, (16 - i) ** 2);
            for (let j = 0; j < duration; j++) {
                this.updateBasic();
            }
        }
        bmps.forEach(bmp => bmp.dispose());
        sprite.dispose();
    }

    // Mosaic screen out
    mosaicOut(duration = 2) {
        const bmps = this.createMosaicBitmapArray();
        const sprite = new Sprite();
        sprite.z = 255;
        sprite.bitmap = new Bitmap(Graphics.width, Graphics.height);
        for (let i = 0; i < 16; i++) {
            sprite.bitmap.stretchBlt(sprite.bitmap.rect, bmps[i], bmps[i].rect);
            sprite.setColor(0, 0, 0, i ** 2);
            for (let j = 0; j < duration; j++) {
                this.updateBasic();
            }
        }
        Graphics.brightness = 0;
        bmps.forEach(bmp => bmp.dispose());
        sprite.dispose();
    }

    // Create mosaic pattern
    createMosaicBitmapArray() {
        const bmp = Graphics.snapToBitmap();
        const bmps = [];
        for (let i = 0; i < 16; i++) {
            bmps[i] = new Bitmap(Graphics.width / (i * 2 + 2), Graphics.height / (i * 2 + 2));
            bmps[i].stretchBlt(bmps[i].rect, bmp, bmp.rect);
        }
        bmp.dispose();
        return bmps;
    }
}
Hello
and thanks for your quick reply!
I tried to add the code you suggest as a plugin in my project.
Unfortunately, I get the following error message when I run the game:

SyntaxError
Identifier 'Game_Temp' has already been declared
Try this (Untested):
From a quick glance, I can spare OP the testing - this won't work.

How exactly did you get this plugin? Because it sure looks a lot like the result of asking an AI to port the original script.
Hello
and thanks for your quick reply!
I tried to add the code you suggest as a plugin in my project.
Unfortunately, I get the following error message when I run the game:

SyntaxError
Identifier 'Game_Temp' has already been declare
When i come from work i test AND i check it maybe i can make this plugin work.
Just a reminder - aside from risking the scorn of @Mac15001900, it is against the forum rules to distribute AI-generated assets, including plugins. Whether they work or not.
When i come from work i test AND i check it maybe i can make this plugin work.
Thank you so much !
Did you have time to check it ?
Hi !

I just tried this plugin : https://hakuenstudio.itch.io/hakuen-studio-map-transitions-for-rpg-maker-mz
but it just doesn't work...
Would anyone be able to convert the Mikagami Atelier version to MZ?

Thanks to all

Original thread: https://forums.rpgmakerweb.com/threads/conversion-mosaic-effect-transfer-pixelated-transition.172510/