m (added gif) |
(added sourcecode) |
||
Line 8: | Line 8: | ||
[[File:arobot.gif]] | [[File:arobot.gif]] | ||
<source lang="python"> | |||
""" | |||
A Robot | |||
""" | |||
s = 100; | |||
def setup(): | |||
size(s*4, s*4) | |||
def draw(): | |||
frameRate (15); | |||
a = PI/12+0.1 * sin(frameCount * 0.2); | |||
print(a); | |||
background(255); | |||
fill(0xFFA4C739); | |||
stroke(0xFFA4C739); | |||
strokeWeight(1); | |||
arc(width/2, height/2-(height/4), s, s, -PI, 0, CHORD); | |||
#arc(width/2, height/2, 100, 100, -PI, 0, CHORD); | |||
rect(width/2-s/2, height/4+s/20, s, s, 0, 0, s/8, s/8); | |||
rect(width/2-(s*0.75)-s/20, height/4+s/20, s/4, s*(3.25/4), s/8); | |||
#rect(width/2+(s*0.5)+s/20, height/4+s/20, s/4, s*(3.25/4), s/8); | |||
wave(width/2+(s*0.5)+s/20, height/4+s/20, a) | |||
rectMode(CORNER) | |||
rect(width/2+(s/15), height/4+s+s/20, s/4, s/2, 0, 0, s/8, s/8); | |||
rect(width/2-s/4-(s/15), height/4+s+s/20, s/4, s/2, 0, 0, s/8, s/8); | |||
strokeCap(ROUND); | |||
strokeWeight(s/20); | |||
line(width/2-s/16, height/2-(height/4)-s/16, width/2-s/2, height/2-(height/4)-s/2); | |||
line(width/2+s/16, height/2-(height/4)-s/16, width/2+s/2, height/2-(height/4)-s/2); | |||
fill(255) | |||
ellipse(width/2-s/5, height/2-(height/4)-(s/4), s/8, s/8); | |||
ellipse(width/2+s/5, height/2-(height/4)-(s/4), s/8, s/8); | |||
saveFrame("line-######.png"); | |||
def wave (x, y, a): | |||
pushMatrix() | |||
translate(x+s/4,y); | |||
rotate(PI+a); | |||
rectMode(CORNERS); | |||
rect(0,0, s/4, s*(3.25/4), s/8); | |||
popMatrix() | |||
</source> |
Latest revision as of 18:33, 29 April 2015
Implementing a RESTful Web API with Python & Flask
"""
A Robot
"""
s = 100;
def setup():
size(s*4, s*4)
def draw():
frameRate (15);
a = PI/12+0.1 * sin(frameCount * 0.2);
print(a);
background(255);
fill(0xFFA4C739);
stroke(0xFFA4C739);
strokeWeight(1);
arc(width/2, height/2-(height/4), s, s, -PI, 0, CHORD);
#arc(width/2, height/2, 100, 100, -PI, 0, CHORD);
rect(width/2-s/2, height/4+s/20, s, s, 0, 0, s/8, s/8);
rect(width/2-(s*0.75)-s/20, height/4+s/20, s/4, s*(3.25/4), s/8);
#rect(width/2+(s*0.5)+s/20, height/4+s/20, s/4, s*(3.25/4), s/8);
wave(width/2+(s*0.5)+s/20, height/4+s/20, a)
rectMode(CORNER)
rect(width/2+(s/15), height/4+s+s/20, s/4, s/2, 0, 0, s/8, s/8);
rect(width/2-s/4-(s/15), height/4+s+s/20, s/4, s/2, 0, 0, s/8, s/8);
strokeCap(ROUND);
strokeWeight(s/20);
line(width/2-s/16, height/2-(height/4)-s/16, width/2-s/2, height/2-(height/4)-s/2);
line(width/2+s/16, height/2-(height/4)-s/16, width/2+s/2, height/2-(height/4)-s/2);
fill(255)
ellipse(width/2-s/5, height/2-(height/4)-(s/4), s/8, s/8);
ellipse(width/2+s/5, height/2-(height/4)-(s/4), s/8, s/8);
saveFrame("line-######.png");
def wave (x, y, a):
pushMatrix()
translate(x+s/4,y);
rotate(PI+a);
rectMode(CORNERS);
rect(0,0, s/4, s*(3.25/4), s/8);
popMatrix()