python-lottie  0.6.8+dev6bb61be
A framework to work with lottie files and telegram animated stickers (tgs)
lottie.objects.bezier.Bezier Class Reference

Single bezier curve. More...

Inheritance diagram for lottie.objects.bezier.Bezier:
[legend]
Collaboration diagram for lottie.objects.bezier.Bezier:
[legend]

Public Member Functions

def __init__ (self)
 
def clone (self)
 Returns a copy of the object. More...
 
def insert_point (self, index, pos, inp=NVector(0, 0), outp=NVector(0, 0))
 Inserts a point at the given index. More...
 
def add_point (self, pos, inp=NVector(0, 0), outp=NVector(0, 0))
 Appends a point to the curve. More...
 
def add_smooth_point (self, pos, inp)
 Appends a point with symmetrical tangents. More...
 
def close (self, closed=True)
 Updates self.closed. More...
 
def point_at (self, t)
 
def tangent_angle_at (self, t)
 
def split_at (self, t)
 Get two pieces out of a Bezier curve. More...
 
def segment (self, t1, t2)
 Splits a Bezier in two points and returns the segment between the. More...
 
def split_self_multi (self, positions)
 Adds more points to the Bezier. More...
 
def split_each_segment (self)
 Adds a point in the middle of the segment between every pair of points in the Bezier. More...
 
def split_self_chunks (self, n_chunks)
 Adds points the Bezier, splitting it into n_chunks additional chunks. More...
 
def reverse (self)
 Reverses the Bezier curve. More...
 
def rounded (self, round_distance)
 
def scale (self, amount)
 
def lerp (self, other, t)
 
def rough_length (self)
 
- Public Member Functions inherited from lottie.objects.base.LottieObject
def to_dict (self)
 Serializes into a JSON object fit for the Lottie format. More...
 
def load (cls, lottiedict)
 Loads from a JSON object. More...
 
def find (self, search, propname="name")
 Recursively searches for child objects with a matching property. More...
 
def find_all (self, type, predicate=None, include_self=True)
 Find all child objects that match a predicate. More...
 
def __str__ (self)
 
- Public Member Functions inherited from lottie.objects.base.LottieObjectMeta
def __new__ (cls, name, bases, attr)
 

Public Attributes

 closed
 Closed property of shape. More...
 
 in_tangents
 Cubic bezier handles for the segments before each vertex. More...
 
 out_tangents
 Cubic bezier handles for the segments after each vertex. More...
 
 vertices
 Bezier curve vertices. More...
 
 points
 More convent way to access points. More...
 

Detailed Description

Single bezier curve.

Lottie JSON
Lottie name Type Description Attribute
c bool Closed property of shape.   closed
i list of NVector Cubic bezier handles for the segments before each vertex.   in_tangents
o list of NVector Cubic bezier handles for the segments after each vertex.   out_tangents
v list of NVector Bezier curve vertices.   vertices

Definition at line 123 of file bezier.py.

Constructor & Destructor Documentation

◆ __init__()

def lottie.objects.bezier.Bezier.__init__ (   self)

Definition at line 134 of file bezier.py.

Member Function Documentation

◆ add_point()

def lottie.objects.bezier.Bezier.add_point (   self,
  pos,
  inp = NVector(0, 0),
  outp = NVector(0, 0) 
)

Appends a point to the curve.

See also
insert_point

Definition at line 173 of file bezier.py.

◆ add_smooth_point()

def lottie.objects.bezier.Bezier.add_smooth_point (   self,
  pos,
  inp 
)

Appends a point with symmetrical tangents.

See also
insert_point

Definition at line 181 of file bezier.py.

◆ clone()

def lottie.objects.bezier.Bezier.clone (   self)

Returns a copy of the object.

Reimplemented from lottie.objects.base.LottieObject.

Definition at line 147 of file bezier.py.

◆ close()

def lottie.objects.bezier.Bezier.close (   self,
  closed = True 
)

Updates self.closed.

Returns
self, for easy chaining

Definition at line 189 of file bezier.py.

◆ insert_point()

def lottie.objects.bezier.Bezier.insert_point (   self,
  index,
  pos,
  inp = NVector(0, 0),
  outp = NVector(0, 0) 
)

Inserts a point at the given index.

Parameters
indexIndex to insert the point at
posPoint to add
inpTangent entering the point, as a vector relative to pos
outpTangent exiting the point, as a vector relative to pos
Returns
self, for easy chaining

Definition at line 156 of file bezier.py.

◆ lerp()

def lottie.objects.bezier.Bezier.lerp (   self,
  other,
  t 
)

Definition at line 457 of file bezier.py.

◆ point_at()

def lottie.objects.bezier.Bezier.point_at (   self,
  t 
)
Parameters
tA value between 0 and 1, percentage along the length of the curve
Returns
The point at t in the curve

Definition at line 197 of file bezier.py.

◆ reverse()

def lottie.objects.bezier.Bezier.reverse (   self)

Reverses the Bezier curve.

Definition at line 409 of file bezier.py.

◆ rough_length()

def lottie.objects.bezier.Bezier.rough_length (   self)

Definition at line 475 of file bezier.py.

◆ rounded()

def lottie.objects.bezier.Bezier.rounded (   self,
  round_distance 
)

Definition at line 428 of file bezier.py.

◆ scale()

def lottie.objects.bezier.Bezier.scale (   self,
  amount 
)

Definition at line 452 of file bezier.py.

◆ segment()

def lottie.objects.bezier.Bezier.segment (   self,
  t1,
  t2 
)

Splits a Bezier in two points and returns the segment between the.

Parameters
t1A value between 0 and 1, percentage along the length of the curve
t2A value between 0 and 1, percentage along the length of the curve
Returns
Bezier object that correspond to the segment between t1 and t2

Definition at line 266 of file bezier.py.

◆ split_at()

def lottie.objects.bezier.Bezier.split_at (   self,
  t 
)

Get two pieces out of a Bezier curve.

Parameters
tA value between 0 and 1, percentage along the length of the curve
Returns
Two Bezier objects that correspond to self, but split at t

Definition at line 243 of file bezier.py.

◆ split_each_segment()

def lottie.objects.bezier.Bezier.split_each_segment (   self)

Adds a point in the middle of the segment between every pair of points in the Bezier.

Definition at line 327 of file bezier.py.

◆ split_self_chunks()

def lottie.objects.bezier.Bezier.split_self_chunks (   self,
  n_chunks 
)

Adds points the Bezier, splitting it into n_chunks additional chunks.

Definition at line 349 of file bezier.py.

◆ split_self_multi()

def lottie.objects.bezier.Bezier.split_self_multi (   self,
  positions 
)

Adds more points to the Bezier.

Parameters
positionslist of percentages along the curve

Definition at line 298 of file bezier.py.

◆ tangent_angle_at()

def lottie.objects.bezier.Bezier.tangent_angle_at (   self,
  t 
)

Definition at line 206 of file bezier.py.

Member Data Documentation

◆ closed

lottie.objects.bezier.Bezier.closed

Closed property of shape.

Definition at line 136 of file bezier.py.

◆ in_tangents

lottie.objects.bezier.Bezier.in_tangents

Cubic bezier handles for the segments before each vertex.

Definition at line 138 of file bezier.py.

◆ out_tangents

lottie.objects.bezier.Bezier.out_tangents

Cubic bezier handles for the segments after each vertex.

Definition at line 140 of file bezier.py.

◆ points

lottie.objects.bezier.Bezier.points

More convent way to access points.

Definition at line 145 of file bezier.py.

◆ vertices

lottie.objects.bezier.Bezier.vertices

Bezier curve vertices.

Definition at line 142 of file bezier.py.


The documentation for this class was generated from the following file: