Page 1 of 1

Tint animated imagebuttons on hover

Posted: Sat Dec 14, 2019 6:10 pm
by Palas
Hello!

I have an imagebutton for which I'd like to add a hover animation. The imagebutton itself is animated, however, so simply using a tinted version of it as a file to use as a "hover" parameter is impossible, or at least very undesirable. I'd like to tint the image somehow. However, im.MatrixColor doesn't seem to accept displayables as parameters. The code I'm currently using is as follows:

Code: Select all

image the_animated_image_in_question:
    "the_animeted_image_in_question_01.png"
    0.04
    "the_animeted_image_in_question_02.png"
    0.04
    "the_animeted_image_in_question_03.png"
    #etc. It doesn't loop. I don't particularly care that the animation will start over as I hover the button either

screen the_screen_where_I_want_the_button():
    imagebutton:
        xalign 0.5 yalign 0.5
        idle "the_animated_image_in_question"
        hover #I have no idea???
        action Jump("what_its_supposed_to_do")
I suppose a style definition would help? Such as:

Code: Select all

style help_me:
    hover_color "b22222" #that a nice color ain't it
But that dosn't seem to help, so I can't really figure out what to do. What am I missing? Or is it impossible to manipulate an animated image/displayable?

Thanks in advance!

EDIT: See this post.

Re: Tint animated imagebuttons on hover

Posted: Sun Dec 15, 2019 12:43 pm
by papillon
Could you define new images as tinted versions of the original frames and then build a hover animation out of those?

I don't think the style definition will help you at all. That sort of color setting usually only affects things drawn directly by the game, like text.

Re: Tint animated imagebuttons on hover

Posted: Sun Dec 15, 2019 12:58 pm
by Palas
papillon wrote:
Sun Dec 15, 2019 12:43 pm
Could you define new images as tinted versions of the original frames and then build a hover animation out of those?

I don't think the style definition will help you at all. That sort of color setting usually only affects things drawn directly by the game, like text.
Yes, although I'm slightly worried about the performance burden of applying MatrixColor to each frame (we're talking 30 frames at 24fps, but I have 5 of these buttons and 3 of them appear at the same time) although, come to think of it, there might be no difference between that and somehow applying it to the animated image as a whole, performance-wise. At this point I might as well edit the frames themselves.

Thanks! I'll just try that and see if the game freezes or something like that.

(Also, fucking love Black Closet ♥)

Re: Tint animated imagebuttons on hover

Posted: Fri Dec 20, 2019 2:27 pm
by Palas
So! A quick update - three animated buttons with a shitload of frames each turned out not to be a good idea after all. In any case, there doesn't seem to be a way to assign a color to animated images through Ren'Py itself. This thread though shows the best way I found to have animated buttons in general so I might as well try it.

I'll leave this as unsolved just in case someone has another idea, but for anyone who's trying to do the same as me: you're probably better off not doing it.