Vivek's Proj10
Skip to end of metadata
Go to start of metadata

In this project, I had to work with turtle and Lsystems to create real drawing effects.

My first task was to create jitter3 effect. Instead I altered jitter function in a way that now if you can create jitter with any number like jitter3 will draw 3 lines, jitter2 will draw 2 lines. The code looks like this:

elif self.style[0:3] == 'jit':
        
            print self.style[0:3]
            (x0,y0)=t.position()
            t.up()
            t.fd(distance)
            (xf,yf)=t.position()
            curwidth = t.width()
            #checks the integer at the end of jitter and loops through to create that many lines
            for i in range(int(self.style[-1])):
            
elif self.style[0:3] == 'jit':     #checks if the style starts with jit

---------

        for i in range(int(self.style[-1])):# loops through to create that many lines as the integer at the end of jitter

My first image:

       
I, then, created a dotted effect. For my extension, I made the position and radius of dots random. The code looks like:

for i in range(num_circles/2):

                #t.down()

                h=t.heading()

                (xx,yy) = t.position()

                t.left(90*random.choice([-1,1])) #go left or right

                t.forward(random.randint(0,5))

                t.down()

                t.begin_fill()

                t.circle(self.dotSize*random.choice([0.5,1,1.5]))

                t.end_fill()

                t.up()

                t.goto(xx,yy)

                t.seth(h)

                t.forward(4* self.dotSize)

                       

For my task3, I added these effects to my inddor scene from last time. ( The painting is so real, it comes out of the frame, impressive art, huh?)

My last task was to create a new lsystem with parameters. I modified sysTree.txt and came up with a new one.

SysTree:
base (5)!(10)J
rule (x)J (0.6*x)F[!+(0.7*x)J<g(5)L>][!-(0.7*x)J<g(5)L>](0.3*x)J(0.4*x)FQ
rule (x)F (0.5*x)F(0.5*x)F
rule Q <r[(2)!(45)+F][(1)!(20)+F][(1)!F][(1)!(20)-F][(2)!(45)-F]>

base (5)!(90)Q
rule (x)Q (0.6*x)F[!(1.2*x)Q<g(5)L>][!(1.3*x)J<g(5)L>](1.3*x)J(1.4*x)FP (0.2*x)F[!(0.4*x)Q<r(5)L>][!(0.7*x)Q<r(5)L>](0.8*x)Q(0.9*x)FP (0.5*x)F[!+(0.6*x)Q<y(5)L>][!-(0.2*x)Q<y(5)L>](0.1*x)Q(1.4*x)FP
rule (x)F (0.5*x)F (0.5*x)F
rule P <r[(2)!(45)+F][(1)!(20)+F][(1)!F][(1)!(20)-F][(2)!(45)-F]>

Modifications:

I added multiple repalcements
I replaced J with Q(if that counts)
The first replacement of (x)Q draws increasing branch, the second one also draws increasing branch but at smaller scale, the third one draws branches which increases and then decreases.
I also changed the color of leaves in my replacement.

It is evident from the following scene:

For my extensions, I created new effects:
 I created a mustache-like effect with a really cool looking code, a pen like interrupted brush effect, a multicolored brush effect.
The mustache, pen and brush look like:

Pen 

Mustache effect

brush

One cool thing about mustache is that if you put + at the end of mustache as in mustache+ as in:

-I created a user input dependent taskA.py file which draws 3*3 grid based on user input shapes and edsign.
--I created drooping effect.
Normal Tree
Drooping tree
# I made it such that when you add Tree = True in draw function, it creates a drooping tree.
-I also tried to create a brush effect based on user input lstring, but it didn't work as expected.

## I learned from this project how to create cool brush effects.

#Credits:
Stephanie
Charles
Matt

c

Labels