send_loop.py 877 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import lib.chat as chat
  2. import time
  3. import lib.motion as motion
  4. def inp():
  5. c = chat.tcp_sender()
  6. while 1:
  7. x = input(":: ")
  8. c.send(x)
  9. fx = []
  10. #for i in range(10):
  11. def loop():
  12. c = chat.tcp_sender()
  13. x = 0
  14. fx1 = motion.Effect(size=30,speed=2500)
  15. fx2 = motion.Effect(TYPE="cosinus",size=30,speed=2500)
  16. fd1 = motion.FadeFast(start=10,target=10,fadetime=4)
  17. while 1:
  18. xfd1= int(fd1.next())
  19. #print("fd",xfd1)
  20. if xfd1 == 10:
  21. fd1 = motion.FadeFast(start=xfd1,target=200,fadetime=4)
  22. if xfd1 == 200:
  23. fd1 = motion.FadeFast(start=xfd1,target=10,fadetime=4)
  24. x1 = int(fx1.next(50))
  25. x2 = int(fx2.next(127))
  26. x += 3
  27. if x >= 255:
  28. x=0
  29. c.send("d201:{},d241:{},d243:{}".format(xfd1,x2,x1))
  30. time.sleep(0.051)
  31. loop()
  32. #inp()