SplineMotion - Ren'Py Visual Novel Engine

documentation index ◦ reference manual ◦ function index

# SplineMotion

Function: | SplineMotion | (points, time, anchors=(0.5, 0.5), repeat=False, bounce=False, anim_timebase=False, time_warp=None, **properties):

This creates a spline-based motion, where a spline may consist of linear segments, quadratic beziers, and cubic beziers.

The path is a list of segments, where each segment is a tuple containing between 1 to 3 points, and an optional time. A point is represented by either an (x, y) pair or an (x, y, xanchor, yanchor) tuple. When not specified in a point, the anchors are taken from the anchors parameter. The time is represented as a floating point number between 0.0 and 1.0, and gives the time when motion along the segment should be complete.

A linear segment consists of a single point, the point to move to.

A quadratic curve contains two points, the point to move to and the single control point.

A cubic curve contains three points, the point to move to and the two control points.

Any time you don't manually specify is linearly interpolated between the previous and following times that are specified. This allows you to specify that at a specific time, the motion will be at a specific point. By default, the start time is 0.0 and the end time is 1.0, unless you specify something different.

There is a spline editor that helps with editing splines.

Repeat, bounce, anim_timebase, and time_warp are as for Motion.

    init python:
        spline = SplineMotion([
            ((-0.042, 0.523,),),
            ((0.768, 0.296,), (0.082, 0.507,), (0.772, 0.573,),),
            ((0.292, 0.304,), (0.766, 0.112,), (0.296, 0.123,),),
            ((1.152, 0.509,), (0.288, 0.555,), (1.076, 0.499,),),
            ], 3.0, anchors=(0.5, 0.5))

    show logo at spline

documentation index ◦ reference manual ◦ function index