GMU:Bots 'n' Plots/Shubhra Bhatt

From Medien Wiki

Shubhra bhatt

News Graffiti Twitter Bot

Screen Shot 2015-10-19 at 12.30.52 am.png


The News Graffiti Twitter Bot places speech bubbles on the images taken from the news accounts on twitter.


First Python Image

My Bot-Bot.png

Code

""" My Bot-Bot """

def setup():

   size(400, 400)
   background(250, 250, 250)
   noStroke()
   fill(250, 138, 120)
   global pX
   pX = width/2
   global pY
   pY = 80

def draw():

   background(250, 250, 250)
       # Head , Eye & Body
   triangle(pX, pY + 80, pX - 80, pY, pX + 80, pY)
   fill(250, 240, 250)
   ellipse(pX - 20, pY + 20, 10, 10)
   ellipse(pX + 20, pY + 20, 10, 10)
   rect(pX - 10, pY + 50, 20, 4)
   
   fill(250, 138, 120)
       # Left Arm
   pushMatrix()
   translate(pX - 50, pY + 80)
   rect(0, 0, 100, 150)
   triangle(0, 0, -50, 80, -60, 50)
   ellipse(50, 180, 80, 80)
   fill(250, 240, 250)
   ellipse(50, 180, 60, 60)
   
       # Right Arm
   popMatrix()
   fill(250, 138, 120)
   pushMatrix()
   translate(pX + 50, pY + 80)
   scale(-1, 1)
   triangle(0, 0, -50, 80, -60, 50)
   popMatrix()    
   saveFrame("My Bot-Bot.png")


First Python Animation

 

Code

""" My Bot-Bot animation """

def setup():

   size(400, 400)
   background(250, 250, 250)
   stroke(255, 240, 250)
   fill(250, 138, 120)
   global pX
   pX = 80
   global pY
   pY = 80
   global prV
   prV=10 
   

def draw():

   bgR = random(50,200)
   bgG = random(50,150)
   bgB = random(240,250)
   background(bgR,bgG,bgB)
   global prV
   global pX
   if pX>0 and pX<width:
      pX=pX+10
   elif pX>width:
       pX=pX-100
   else:
       pX=80    
       # Head , Eye & Body
   triangle(pX, pY + 80, pX - 80, pY, pX + 80, pY)
   fill(250, 240, 250)
   ellipse(pX - 20, pY + 20, 10, 10)
   ellipse(pX + 20, pY + 20, 10, 10)
   rect(pX - 10, pY + 50, 20, 4)


   fill(250, 138, 120)
       # Wheel
   pushMatrix()
   translate(pX - 50, pY + 80)
   rect(0, 0, 100, 150)
   ellipse(50, 180, 80, 80)
   fill(bgR, bgG, bgB)
   ellipse(50, 180, 60, 60)
   fill(250, 138, 120)
       # Left Arm
   rotate(-PI/8 * sin(frameCount * 0.1))
   triangle(0, 0, -50, 80, -60, 50)
   
   
       # Right Arm
   popMatrix()
   fill(250, 138, 120)
   pushMatrix()
   translate(pX + 50, pY + 80)
   rotate(PI/8 * sin(frameCount * 0.1))
   scale(-1, 1)
   triangle(0, 0, -50, 80, -60, 50)
   popMatrix()
   delay(80)
   saveFrame("bot###.png")