Page 1 of 1

practical way to flip aligned character image around center?

Posted: Wed Feb 08, 2017 7:17 am
by Kia
I've been fiddling with character images to make some transforms for a friend and noticed there's no good way to align an image to one side then flip it around center, we can sacrifice the awesome power of automatic anchor in align to set a fixed anchor:

Code: Select all

transform lnf:
    easein .4 xzoom -1 xanchor .5

label start:
    show char1 at left
    e "saying something"
    show char1 at lnf
    e "saying something else"
    return
but nobody wants to guess the correct align for every image right? is there an obscure parameter I didn't try? because I tried everything inside ATL page and even transform_anchor didn't help.

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 7:49 am
by indoneko
Did you mean to flip the image at the same position by using im.Flip function? or is it something completely different? Do you have any pic to illustrate this?

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 8:44 am
by Kia
you can copy and paste the code I've provided into a game and use any image to see how it looks, I wonder if people still use im.Flip, that code was old even the day I started using renpy.

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 9:22 am
by indoneko
I tried your code, and by changing the xanchor value to 1 (instead of 0.5) it flips the image just like what im.Flip does (plus the animation). I wonder in what kind of scene/situation do you use this transform?

You might also be interested in Zankizuna's post in Renpy's cookbook section about a "dancing" sprite.
viewtopic.php?f=51&t=42338

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 9:37 am
by Kia
as I mentioned before changing xanchor is not a practical solution, and now you make me wonder what part of this look right to you?
Screenshot_1.png

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 10:07 am
by indoneko
I tried your code with slight modification, and it gives me this result (see attachment below).
Pardon me for being slow, but I'm not really sure what you want to achieve here. Do you want to animate it while flipping the image? or just flipping it? or something else? Please photoshop a dummy snapshot to show how you really want it to look (before + after the operation).

Code: Select all

transform lnf:
    easein .4 xzoom -1 xanchor 1
image happy = "eileen_happy.png" 

label start:
    show happy at left
    "saying something"
    show happy at lnf
    "saying something else"
    pause
    return
We can actually use flip if I don't need the animation (though I guess you've already known about this already)

Code: Select all

image eileen flip = im.Flip("eileen_happy.png", horizontal=True) 

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 10:39 am
by Kia
I think you didn't pay much attention to my first post while reading it.
"flip it around center" means I want the animation flip around the center of image (can't find a more clear way to say it sorry)
it would be fine if I position the image in center because with "xalign .5" the "xanchor" would be .5 as well, the problem is by moving the image to the sides (with align) the pivot point or "xanchor" shifts to the side of image. this shifting is necessary to keep the image inside the window, but causes the image flip around the shifted anchor. adding "xanchor 1.0" wont solve the anchor animation problem and even if it did it couldn't be a solution for all images that might be aligned to somewhere else.
I'm not asking for a solution because I can come up with a way to calculate and position the image, I'm asking to see if there is a practical way to do it that I might overlooked.

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 11:01 am
by xela
Kia wrote:I'm not asking for a solution because I can come up with a way to calculate and position the image, I'm asking to see if there is a practical way to do it that I might overlooked.
Nothing comes to mind... you'll have to figure out positioning with anchor .5 and flip the image under that setup.

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 11:09 am
by Kia
ah thanks xela, that was what I wanted to avoid, what's your input for asking Tom for something like:

Code: Select all

transform lnf:
    easein .4 xzoom(0.5,0.5) -1
in later versions?
having the option to specify an anchor point independent of the main anchor in the transformation might come handy some time right?

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 11:42 am
by xela
Kia wrote:for something like:
Sounds messy... but something like zoomanchor could be a thing. There was a talk about atl2 a while back, not sure if that is still on the table to be implemented any time soon.

Re: practical way to flip aligned character image around cen

Posted: Wed Feb 08, 2017 12:04 pm
by Kia
good idea, I'm on it.
about atl2: it seems 5 years passed, I think the development has continued under the old name.