当前位置: 首页>>代码示例>>Python>>正文


Python art.line函数代码示例

本文整理汇总了Python中tealight.art.line函数的典型用法代码示例。如果您正苦于以下问题:Python line函数的具体用法?Python line怎么用?Python line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了line函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: linethree

def linethree(x1,y1,z1,x2,y2,z2):

  a1=x1*math.cos(phi)-y1*math.sin(phi)
  b1=x1*math.sin(phi)+y1*math.cos(phi)
  
  c1=b1*math.cos(theta)-z1*math.sin(theta)
  d1=b1*math.sin(theta)+z1*math.cos(theta)
  
  e1=screen_width/2+a1*math.cos(alpha)-c1*math.sin(alpha)
  f1=screen_height/2+a1*math.sin(alpha)+c1*math.cos(alpha)
  
  
  a2=x2*math.cos(phi)-y2*math.sin(phi)
  b2=x2*math.sin(phi)+y2*math.cos(phi)
  
  c2=b2*math.cos(theta)-z2*math.sin(theta)
  d2=b2*math.sin(theta)+z2*math.cos(theta)
  
  e2=screen_width/2+a2*math.cos(alpha)-c2*math.sin(alpha)
  f2=screen_height/2+a2*math.sin(alpha)+c2*math.cos(alpha)
  
#  a1=screen_width/2+x1*math.sqrt(3)/2-y1/2
#  b1=screen_height/2+x1/2+y1*math.sqrt(3)/2-z1
#  a2=screen_width/2+x2*math.sqrt(3)/2-y2/2
#  b2=screen_height/2+x2/2+y2*math.sqrt(3)/2-z2
  line(e1,f1,e2,f2)
开发者ID:jamesmunro123,项目名称:tealight-files,代码行数:26,代码来源:3d.py

示例2: handle_message

def handle_message(message):
  if message["type"] == "reset":
    initialPlayer2()
  
  if message["type"] == "line":    
    color(message["color"])
    line(message["x1"], message["y1"], message["x2"], message["y2"])
开发者ID:darkchaoticlord,项目名称:tealight-files,代码行数:7,代码来源:pictionaryPlayer2.py

示例3: handle_mousemove

def handle_mousemove(x,y,button):
  global lastx, lasty
  
  if button == "left":
    line(lastx, lasty, x, y)
    lastx = x
    lasty = y
开发者ID:Alex-Thornton,项目名称:tealight-files,代码行数:7,代码来源:sketch.py

示例4: handle_mousedown

def handle_mousedown(x,y):
  global lastx, lasty
  
  if button == "right":
    line(lastx, lasty, x, y)
    lastx = x
    lasty = y 
开发者ID:chandler6,项目名称:tealight-files,代码行数:7,代码来源:sketch.py

示例5: handle_mousemove

def handle_mousemove(x,y,button):
  global lastx, lasty
  
  if button == "left":
    line(lastx, lasty, x, y)
    send({"x1": lastx, "y1": lasty, "x2": x, "y2": y})
    lastx = x
    lasty = y
开发者ID:jmlowenthal,项目名称:tealight-files,代码行数:8,代码来源:shared_whiteboard.py

示例6: handle_mousemove

def handle_mousemove(x, y, button):
   global xpos, ypos
    
   if button == "left":
    line(xpos, ypos, x, y)
    send({"xpos":xpos, "ypos":ypos, "x":x,"y":y})
    xpos = x
    ypos = y
开发者ID:sagelin,项目名称:tealight-files,代码行数:8,代码来源:input.py

示例7: handle_mousemove

def handle_mousemove(x,y,button):
  global lastx, lasty, hue
  
  if button == "left":
    line(lastx, lasty, x, y)
    lastx = x
    lasty = y
    color("hsl(%d,100%%,50%%)" % hue)
    hue += 1
开发者ID:anthonyajsmith,项目名称:tealight-files,代码行数:9,代码来源:sketch.py

示例8: parallel

def parallel(x1,y1,x2,y2,x3,y3):
  x1=int(x1)
  y1=int(y1)
  x2=int(x2)
  y2=int(y2)
  x3=int(x3)
  y3=int(y3)
  for i in range(x1,x2):
    line(i,(y2-y1)*(i-x1)/(x2-x1)+y1,x3-x1+i,(y2-y1)*(i-x1)/(x2-x1)+y3)
开发者ID:jamesmunro123,项目名称:tealight-files,代码行数:9,代码来源:squares.py

示例9: handle_mousemove

def handle_mousemove(x,y):
  global lastx, lasty, hue
  
  line(lastx or x, lasty or y, x, y)
  color("hsl(%d,100%%,50%%)" % hue)
  
  hue += 1
  
  lastx = x
  lasty = y
开发者ID:a-l-williams,项目名称:tealight-files,代码行数:10,代码来源:art-demo.py

示例10: star

def star(x, y, c, w, h, spines):

    color(c)

    angle = 0

    for i in range(0, spines):
        x0 = x + (w * cos(angle))
        y0 = y + (h * sin(angle))
        line(x, y, x0, y0)
        angle = angle + (2 * pi / spines)
开发者ID:jmlowenthal,项目名称:tealight-files,代码行数:11,代码来源:stars.py

示例11: handle_mousemove

def handle_mousemove(x,y,button):
  global lastx, lasty
  
  if button == "left":
    line(lastx, lasty, x, y)
    lastx = x
    lasty = y
  elif button == "right":
    color("red")
    line(lastx, lasty, x, y)
    lastx = x
    lasty = y
开发者ID:iTomaaaHD,项目名称:tealight-files,代码行数:12,代码来源:sketch.py

示例12: star

 def star(self, x, y, c, size, spines):
   color(c)
   
   angle = 0
   
   for i in range(0, spines):
     x0 = x + (size * cos(angle))
     y0 = y + (size * sin(angle))
     
     line(x, y, x0, y0)
     
     angle = angle + (2 * pi / spines)
开发者ID:rexapex,项目名称:tealight-files,代码行数:12,代码来源:explosion.py

示例13: star

def star(x, y, c, rx, ry, spines):
  
  color(c)
  
  angle = 0
  
  for i in range(0, spines):
    x0 = x + (rx * cos(angle))
    y0 = y + (ry * sin(angle))
    
    line(x, y, x0, y0)
    
    angle = angle + (2 * pi / spines)
开发者ID:BasRegi,项目名称:tealight-files,代码行数:13,代码来源:stars.py

示例14: handle_mousemove

def handle_mousemove(x,y,button):
  global lastx, lasty
  
  if button == "left":
    color("red")
  elif button == "right":
    color("blue")
  else:
    return
  
  line(lastx, lasty, x, y)
  lastx = x
  lasty = y
开发者ID:jmlowenthal,项目名称:tealight-files,代码行数:13,代码来源:sketch.py

示例15: handle_mousemove

def handle_mousemove(x,y,button):
  global lastx, lasty
  
  if button == "left":
    color("blue")
    line(lastx, lasty, x, y)
    lastx = x
    lasty = y
  if button == "right":
    color("black")
    line(lastx, lasty, x, y)
    lastx = x
    lasty = y
开发者ID:NickMcAlpin,项目名称:tealight-files,代码行数:13,代码来源:sketch.py


注:本文中的tealight.art.line函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。