Skip to content

Commit

Permalink
add new arg to other CurveBase classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarx committed Mar 24, 2023
1 parent 2f2f7e2 commit 669e564
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/keyframed/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def __getitem__(self, k) -> Number:
pass

def _adjust_k_for_looping(self, k:Number, loop_margin=1) -> Number:
if hasattr(self, 'loop_margin'):
loop_margin = self.loop_margin
n = (self.duration + loop_margin)
if self.loop and k >= max(self.keyframes):
k %= n
Expand Down Expand Up @@ -243,6 +245,7 @@ def __init__(self,
bounce: bool = False,
duration:Optional[float]=None,
label:str=None,
loop_margin:Number=1,
):
"""
Initializes a curve from a dictionary or another curve.
Expand All @@ -269,6 +272,7 @@ def __init__(self,
label = self.random_label()
self._using_default_label = True
self.label=str(label)
self.loop_margin = loop_margin

@property
def keyframes(self) -> list:
Expand Down Expand Up @@ -509,8 +513,10 @@ def __init__(
label=None,
loop: bool = False,
bounce: bool = False,
loop_margin=1,
):
self.loop, self.bounce = loop, bounce
self.loop_margin = loop_margin
if isinstance(parameters, list) or isinstance(parameters, tuple):
d = {}
for curve in parameters:
Expand Down Expand Up @@ -693,8 +699,10 @@ def __init__(
label:str=None,
loop:bool=False,
bounce:bool=False,
loop_margin=1,
):
self.loop, self.bounce = loop, bounce
self.loop_margin = loop_margin
self.reduction = reduction
super().__init__(parameters=parameters, weight=weight, label=label)
# uh.... let's try this I guess?
Expand Down

0 comments on commit 669e564

Please sign in to comment.