Skip to content

Waypoint

sangfroid.value.Waypoint(time, value, before='clamped', after='clamped') #

A waypoint is a marker on a layer field's timeline, recording that the attribute should have the given value at the given time. It also gives the interpolation, before and after: that is, the behaviour of the value between this waypoint and those on either side.

Waypoints can be compared with other Waypoints: earlier times sort before later times.

Parameters:

Name Type Description Default
value typing.Any

the value of the attribute at the given time. Must not be animated: can you imagine a timeline where there were animations inside the animations? Enough to give anyone a headache and a ValueError.

required
time sangfroid.t.T

when the attribute should reach this value. On reading, this is always T. It can also be set using a string or an integer; in these cases it is cast to T on reading; where T would require a reference tag, the waypoint's own tag is used. For any other type, raises TypeError.

required
after str

one of the interpolation behaviours. In string representations of Waypoints, each is represented by an emoji which (somewhat) corresponds to the symbol used by Synfig Studio. They are:

  • tcb (🟢)
  • clamped (🔶) (the default)
  • constant (🟥)
  • linear (🌽)
  • ease (🫐)

These are the names used in Synfig Studio's UI. You can also use the names that appear in .sif files; they are misleading, so this is probably better avoided. They are:

  • auto (synonym for tcb)
  • halt (synonym for ease)

The other behaviours have the same names in both.

Unknown names raise TypeError. If a Waypoint is found with interpolations which don't fit into our understanding, they appear as "undefined" (🪨). This shouldn't happen.

'clamped'
before str

see after.

'clamped'

Raises:

Type Description
TypeError

if before or after isn't the name of an interpolation type.

Attributes:

Name Type Description
tag bs4.Tag

the tag which would represent this Waypoint in a .sif file.

Source code in sangfroid/value/value.py
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
def __init__(self,
             time:T,
             value: Any,
             before: str='clamped',
             after: str='clamped'):

    if not isinstance(value, Value):
        raise TypeError(value)

    if value.is_animated:
        raise ValueError("Waypoints can't have animated values")

    before = self._check_interpolation_type(before, True)
    after = self._check_interpolation_type(after, True)

    self.tag = bs4.Tag(name="waypoint")
    self.tag['time'] = str(time)
    self.tag['before'] = INTERPOLATION_TYPES[before][0]
    self.tag['after']  = INTERPOLATION_TYPES[after ][0]
    self.tag.append(
            copy.copy(
                value.tag
                )
            )