Transforms without starting points
Posted: Mon Feb 06, 2023 10:39 pm
I've been experimenting with renpy.show_layer_at to dynamically alter the "viewport" into a Movie so that I can effectively zoom and pan while it's playing. I can define a few transitions:
and then use something like
When I call this passing in the transform object, the screen will pan and zoom the way I want it to. All good. But, what I want to do is generalize this, so that for different movies, I don't have to hard-code individual transforms. What I'd rather do is just have data structures, and build the appropriate transform on the fly.
Now, I know that I can code custom transforms (https://renpy.org/doc/html/trans_trans_ ... #Transform) by providing an appropriate function to alter the xpos, ypos and zpos values using the shown time base and animation time base. I've done that before. The kicker is this - the transforms coded above in "Ren'py language" don't have "from" and "to" values, just "to" values, but Ren'py is quite capable of running the transition from wherever things are now to the values I coded, over the period of time I coded. So, it's somehow figuring out the starting value on the fly so that it can interpolate to the end value.
So, my question is, how would I do the same? Specifically with the camera object, since that's what I'm using above. I don't know how to find out the "at the beginning of the transition" values. If I can do that, I can code an appropriate callable and use it with the Transform class, but I don't know how to get them.
Help?
Code: Select all
transform return_full_screen:
linear 1.0 xpos 0 ypos 0 zpos 0
transform t1:
linear 1.0 xpos 100 ypos 100 zpos -100
Code: Select all
def play_transform(t):
renpy.show_layer_at([t], reset=False, camera=True)
Now, I know that I can code custom transforms (https://renpy.org/doc/html/trans_trans_ ... #Transform) by providing an appropriate function to alter the xpos, ypos and zpos values using the shown time base and animation time base. I've done that before. The kicker is this - the transforms coded above in "Ren'py language" don't have "from" and "to" values, just "to" values, but Ren'py is quite capable of running the transition from wherever things are now to the values I coded, over the period of time I coded. So, it's somehow figuring out the starting value on the fly so that it can interpolate to the end value.
So, my question is, how would I do the same? Specifically with the camera object, since that's what I'm using above. I don't know how to find out the "at the beginning of the transition" values. If I can do that, I can code an appropriate callable and use it with the Transform class, but I don't know how to get them.
Help?