practical way to flip aligned character image around center?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Kia
Eileen-Class Veteran
Posts: 1011
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

practical way to flip aligned character image around center?

#1 Post by Kia » Wed Feb 08, 2017 7:17 am

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.

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: practical way to flip aligned character image around cen

#2 Post by indoneko » Wed Feb 08, 2017 7:49 am

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?
My avatar is courtesy of Mellanthe

User avatar
Kia
Eileen-Class Veteran
Posts: 1011
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: practical way to flip aligned character image around cen

#3 Post by Kia » Wed Feb 08, 2017 8:44 am

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.

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: practical way to flip aligned character image around cen

#4 Post by indoneko » Wed Feb 08, 2017 9:22 am

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
My avatar is courtesy of Mellanthe

User avatar
Kia
Eileen-Class Veteran
Posts: 1011
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: practical way to flip aligned character image around cen

#5 Post by Kia » Wed Feb 08, 2017 9:37 am

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

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: practical way to flip aligned character image around cen

#6 Post by indoneko » Wed Feb 08, 2017 10:07 am

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) 
Attachments
screenshot0002.png
flipped image
My avatar is courtesy of Mellanthe

User avatar
Kia
Eileen-Class Veteran
Posts: 1011
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: practical way to flip aligned character image around cen

#7 Post by Kia » Wed Feb 08, 2017 10:39 am

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.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: practical way to flip aligned character image around cen

#8 Post by xela » Wed Feb 08, 2017 11:01 am

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.
Like what we're doing? Support us at:
Image

User avatar
Kia
Eileen-Class Veteran
Posts: 1011
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: practical way to flip aligned character image around cen

#9 Post by Kia » Wed Feb 08, 2017 11:09 am

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?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: practical way to flip aligned character image around cen

#10 Post by xela » Wed Feb 08, 2017 11:42 am

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.
Like what we're doing? Support us at:
Image

User avatar
Kia
Eileen-Class Veteran
Posts: 1011
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: practical way to flip aligned character image around cen

#11 Post by Kia » Wed Feb 08, 2017 12:04 pm

good idea, I'm on it.
about atl2: it seems 5 years passed, I think the development has continued under the old name.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]