renpy 立绘移动、抖动
transform moveslide_slightleft:
linear 0.3 xpos 0.35
linear 平滑移动 时长+终点
transform focus
crop(0,0,800,600)
size(1920,1080)
crop单用是裁切,和size一起能够聚焦
Shake Effect
You can already use the default vpunch and hpunch transitions to shake the screen. But what about a shake that goes in every directions randomly, Phoenix Wright style?
init:
python:
import math
class Shaker(object):
anchors = {
'top' : 0.0,
'center' : 0.5,
'bottom' : 1.0,
'left' : 0.0,
'right' : 1.0,
}
def __init__(self, start, child, dist):
if start is None:
start = child.get_placement()
#
self.start = [ self.anchors.get(i, i) for i in start ] # central position
self.dist = dist # maximum distance, in pixels, from the starting point
self.child = child
def __call__(self, t, sizes):
# Float to integer... turns floating point numbers to
# integers.
def fti(x, r):
if x is None:
x = 0
if isinstance(x, float):
return int(x * r)
else:
return x
xpos, ypos, xanchor, yanchor = [ fti(a, b) for a, b in zip(self.start, sizes) ]
xpos = xpos - xanchor
ypos = ypos - yanchor
nx = xpos + (1.0-t) * self.dist * (renpy.random.random()*2-1)
ny = ypos + (1.0-t) * self.dist * (renpy.random.random()*2-1)
return (int(nx), int(ny), 0, 0)
def _Shake(start, time, child=None, dist=100.0, **properties):
move = Shaker(start, child, dist=dist)
return renpy.display.layout.Motion(move,
time,
child,
add_sizes=True,
**properties)
Shake = renpy.curry(_Shake)
#
#