Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2
- from math import *
- import os
- import time
- ### Classy plasma ############################################
- class Plasma:
- width, height = 60, 40
- i = 1
- def dim(_, val):
- greyscale = "@MBHENR#KWXDFPQASUZbdehx*8Gm&04LOVYkpq5Tagns69owz$CIu23Jcfry%1v7l+it[]{}?j|()=~!-/<>\\\"^_';,:`. "
- return greyscale[int(min(1.0,max(0.0,val))*(len(greyscale)-1))]
- def update(_):
- _.i += 1
- def render(_):
- i = _.i
- i = i/1000.0
- for y in range(0, _.height):
- line = ""
- for x in range(0, _.width):
- #line += _.dim((sin(x*(i/(cos(y))))*tan(y*i))*(i/(x+1)))
- #line += _.dim(((sin(y*(i/(cos(x))))*tan(x*i))*(i/(x+1)))*(i*(y+1)))
- #line += _.dim(i/((x*y/20)+1))
- #line += _.dim(sin((i/2)/((sin(x*i)*cos(y*i)/200)+1)))
- #line += _.dim(sin((i/2)/((sin(x*i)*(y*i)/200)+1)))
- line += _.dim(sin(tan(cos(x*y*(i/4)))))
- print(line)
- def run(_):
- clear()
- while True:
- home()
- _.render()
- _.update()
- time.sleep(0.01)
- ### Utilities ###############################################
- def clear():
- print('\x1b[2J')
- def home():
- print('\x1b[H')
- def main():
- return '__main__' == __name__
- ### Main ####################################################
- if main():
- Plasma().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement