turtle.shearfactor() function in Python
Last Updated :
01 Aug, 2020
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
turtle.shearfactor()
This function is used to set or return the current shearfactor. It Shears the turtleshape according to the given shearfactor shear, which is the tangent of the shear angle.
Syntax : turtle.shearfactor(shear=None)
Parameter:
shear(optional): number, tangent of the shear angle.
Below is the implementation of the above method with some examples :
Example 1 :
Python3
import turtle
turtle.speed( 1 )
turtle.shape( "turtle" )
turtle.up()
turtle.goto( - 150 , 0 )
turtle.down()
turtle.forward( 100 )
turtle.shearfactor( 0.2 )
turtle.forward( 100 )
turtle.shearfactor( - 0.2 )
turtle.forward( 100 )
|
Output :
Example 2 :
Python3
import turtle
turtle.speed( 1 )
turtle.up()
turtle.goto( - 40 , 40 )
turtle.down()
turtle.shearfactor( 0.5 )
sh = turtle.getshapes()
for i in range ( len (sh)):
turtle.shape(sh[i])
turtle.forward( 100 + 10 * i)
turtle.right( 90 )
turtle.forward( 100 + 10 * i)
turtle.right( 90 )
|
Output :
Share your thoughts in the comments
Please Login to comment...