curve¶
-
class
guerilla.curve¶ Bases:
objectA curve is a curve with a set of keys and tangents
-
addkey(x, y)¶ Add a key into a curve
Parameters: - x (number) – The x coordinate of the key
- y (number) – The y coordinate of the key
-
copy(source)¶ Copy a curve content into another
Parameters: source ( curve) – The source curve to copy
-
createorsetkey(x, y)¶ Create/set a key
Parameters: - x (number) – the x coordinate of the key to set
- y (number) – the y coordinate of the key to set
Returns: the 1-based index of the key
Return type: number
-
deletekey(index)¶ Delete a key
Parameters: index (number) – the 1-based index of the key to delete
-
getflags()¶ Get the curve flags
Returns: the flags of the curve Return type: number
-
getkeycount()¶ Get the number of keys of the curve
Returns: the number of keys Return type: number
-
getkeyflags(index)¶ Get the key flags
Parameters: index (number) – the 1-based index of the key Returns: the flags of the key Return type: number
-
getkeylimit(index)¶ Get the key limit, on the left and right sides
Parameters: index (number) – the 1-based index of the key Returns: the left and right limits of the key Return type: number,number
-
getkeypos(index)¶ Get a key coordinates
Parameters: index (number) – the 1-based index of the key in the curve Returns: the x,y coordinates of the key Return type: number,number
-
getkeytanpos(index)¶ Get the key tangent positions
Parameters: index (number) – the 1-based index of the key Returns: the previous x,y and next x,y coordinates of the key tangents Return type: number,number,number,number
-
getvalue(x)¶ Evaluate a curve at a given x
Parameters: x (number) – the x position to evaluate the curve at Returns: the evaluated y value of the curve at x Return type: number
-
haskey(x)¶ Tell if there is a key at x
Parameters: x (number) – the x coordinate of the key to set Returns: true if the key exists Return type: bool
-
setflags(flags, mask)¶ Set the curve flags
Parameters: - flags (number) – the flags to set
- mask (number or None) – the mask of flags to set (or nil to reset all flags)
-
setkeyflags(index, flags, mask)¶ Set the key flags
Parameters: - index (number) – the 1-based index of the key
- flags (number) – the flags of the key to set
- mask (number or None) – the mask of flags to set (or nil to reset all flags)
-
setkeypos(index, x, y)¶ Set a key coordinates
Parameters: - index (number) – the 1-based index of the key in the curve
- x (number) – the x coordinate of the key to set
- y (number) – the y coordinate of the key to set
-
setkeytanpos(index, px, py, nx, ny)¶ Set the key tangent positions
Parameters: - index (number) – the 1-based index of the key
- px (number) – the x coordinate of the previous tangent position
- py (number) – the y coordinate of the previous tangent position
- nx (number) – the x coordinate of the next tangent position
- ny (number) – the y coordinate of the next tangent position
-