Setting picture origin to bottom left?

Working on a UI for a mini-game in my MV game, and I'm trying to create some energy bars.

However, MV's "show picture" command only allows for origins in the top left and centre - but my bars are going to expand upwards, so I need to have the bar's image's origin at the bottom. I'm already scaling the image via a "Script..." call in an event; is there a way to do to the origin in javascript too?
In a sense! You can use _targetY (I assume you have something similar already with _targetScaleY), e.g.
Code:
var pic = $gameScreen.picture(1);
pic._targetY = $gameVariables.value(8);
pic._duration = 6;
^ This ought to set picture #1's target y coordinate to the value of game variable #8 and the transition time to 6 frames. Edit it however you like! 🙏

So, the origin doesn't change, but you can offset the existing origin to suit your purposes. 🙂
In a sense! You can use _targetY (I assume you have something similar already with _targetScaleY), e.g.
Code:
var pic = $gameScreen.picture(1);
pic._targetY = $gameVariables.value(8);
pic._duration = 6;
^ This ought to set picture #1's target y coordinate to the value of game variable #8 and the transition time to 6 frames. Edit it however you like! 🙏

So, the origin doesn't change, but you can offset the existing origin to suit your purposes. 🙂

Thanks!

Yeah, I was aware I could offset the image in order to do that, but naturally it would be better if I could just define a different origin and use that. I scale my images and I'll have to do some maths to work out where the image should be relative to the origin point in order for it to scale correctly.
Unfortunately you can't just access the picture sprite via a script call and update its anchors directly, since those are updated each frame according to the picture's "origin" (top-left or center):
Spoiler: Relevant code excerpt
Code:
Sprite_Picture.prototype.updateOrigin = function() {
    var picture = this.picture();
    if (picture.origin() === 0) {
        this.anchor.x = 0;
        this.anchor.y = 0;
    } else {
        this.anchor.x = 0.5;
        this.anchor.y = 0.5;
    }
};
It should be possible to write a plugin to extend the "origin" options there, maybe one already exists? I found this thread, haven't experimented:
https://forums.rpgmakerweb.com/index.php?threads/origin-set-custom-anchor-picture.75266/

Also, I found this utility plugin; not sure if it offers custom anchors but may be helpful anyway:
https://forums.rpgmakerweb.com/index.php?threads/move-picture-extended.108511/
Yes, but then you will only be able to use this new feature via script call. Though I'm sure you prefer it this way since you're making a bar out of it...

Spoiler: Make a new js file and paste this code
Code:
(function() {

    Sprite_Picture.prototype.updateOrigin = function() {
        var picture = this.picture();
        if (picture.origin() === 0) {
            // upper right
            this.anchor.x = 0;
            this.anchor.y = 0;
        } else if (picture.origin() === 1) {
            // center
            this.anchor.x = 0.5;
            this.anchor.y = 0.5;
        } else {
            // bottom left
            this.anchor.x = 0;
            this.anchor.y = 1;
        }
    };

})();

Alternatively, there's a tricky way around it. MV pictures support negative value for zoom property. Making use of it, with the "upper left" origin you can create the same effect to changing its origin.

upload_2019-9-7_17-18-32.png

Negative width = upper right origin
Negative height = bottom left origin
Negative width and negative height = bottom right origin

The only issue, well, the image will be flipped. But I'm pretty sure that won't be a problem for you. I actually prefer it this way.
Here is a quickie plugin I created that will allow you to customize the default origin points for pictures : Custom Origin

Original thread: https://forums.rpgmakerweb.com/threads/setting-picture-origin-to-bottom-left.113013/