Created
          July 14, 2022 09:50 
        
      - 
      
- 
        Save Especuloide/8764acc56c40d74d62e1e3be33e34ab2 to your computer and use it in GitHub Desktop. 
    Skeleton Creature
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import matplotlib | |
| import numpy as np | |
| import matplotlib.animation as animation | |
| from matplotlib import pyplot | |
| fig, g = pyplot.subplots(figsize=(11,11)) | |
| pyplot.subplots_adjust(top = 1.01, left = -0.01, right = 1.01, bottom = -0.01) | |
| bkg = '#282828' # Backgroung color | |
| pyplot.rcParams['axes.facecolor'] = bkg | |
| pyplot.rcParams['savefig.facecolor'] = bkg | |
| def Circle(r,v,n): | |
| Ex = [] | |
| Ey = [] | |
| ps = 20 | |
| n = n*ps | |
| for x in range(0+v,n+v+1,ps) : | |
| Ex.append(np.cos((2*np.pi)/(n)*x)*r) | |
| Ey.append(np.sin((2*np.pi)/(n)*x)*r) | |
| Ex = np.asarray(Ex) | |
| Ey = np.asarray(Ey) | |
| return Ex,Ey | |
| def Circle1(r,v,n,pm,tp): # Modified circle | |
| Ex = [] | |
| Ey = [] | |
| m = np.arange(-n+2+1,n+2+1)/2 + 1 | |
| d = 0 | |
| if tp == 0 : | |
| for x in range(0+v,n+v+1) : | |
| Ex.append(np.cos(pm*np.pi/n*x)*r * m[d]) | |
| Ey.append(np.sin(pm*np.pi/n*x)*r * m[d]) | |
| d+=1 | |
| else : | |
| for x in range(0+v,n+v+1) : | |
| Ey.append(np.cos(pm*np.pi/n*x)*r * m[d]) | |
| Ex.append(np.sin(pm*np.pi/n*x)*r * m[d]) | |
| d+=1 | |
| Ex = np.asarray(Ex) | |
| Ey = np.asarray(Ey) | |
| return Ex,Ey | |
| fr = 40 # Number of frames | |
| # counters | |
| ct = 0 | |
| ct1 = 1 | |
| cor = pyplot.cm.binary # colormap used | |
| def update(*args) : | |
| global fig, g, ct, ct1 | |
| pyplot.clf() | |
| ax = fig.add_subplot(111,projection='3d') | |
| ax.set_box_aspect((1,1,1)) | |
| Xp,Yp = Circle(3, 0, 256) # Circle of size 3, 0 position and 256 points | |
| ctmv = 0 | |
| ctmv1 = 0 | |
| sz = 0.6 | |
| for r in range(0,len(Xp)-1,2) : | |
| Xp1,Yp1 = Circle1(sz, -ct1+int(ctmv), 20, 1, 0) | |
| Xp1a,Yp1a = Circle1(sz, -ct1+int(ctmv1) + 40, 20, 1, 2) | |
| Xpc = Xp1.tolist() + Xp1a.tolist() | |
| Ypc = Yp1.tolist() + Yp1a.tolist() | |
| zl = 0 # z axis | |
| ln = 0.1 | |
| cr = 0 | |
| for n in range(0,32) : | |
| clr = cor(int(cr)) | |
| ax.plot(Xp[r]+Xpc,Yp[r]+Ypc, zl, zdir = 'z',color = clr, linewidth = ln, alpha = 1) | |
| zl -= 0.01 # z axis decreases | |
| ln += 0.2 # line tickness increases | |
| cr += 4 # color change | |
| # movement deslocation | |
| ctmv -= 1 # 0 | |
| ctmv1 += 1 # 1 | |
| a = 5.5 # scale | |
| ax.set_xlim3d(-a, a) | |
| ax.set_ylim3d(-a, a) | |
| ax.set_zlim3d(-a, a) | |
| ax.yaxis.line.set_color((1.0,1.0,1.0,0.0)) | |
| ax.xaxis.line.set_color((1.0,1.0,1.0,0.0)) | |
| ax.zaxis.line.set_color((1.0,1.0,1.0,0.0)) | |
| ax.xaxis.set_pane_color((1.0,1.0,1.0,0.0)) | |
| ax.yaxis.set_pane_color((1.0,1.0,1.0,0.0)) | |
| ax.zaxis.set_pane_color((1.0,1.0,1.0,0.0)) | |
| ax.set_yticklabels([]) | |
| ax.set_xticklabels([]) | |
| ax.set_zticklabels([]) | |
| ax.set_yticks([]) | |
| ax.set_xticks([]) | |
| ax.set_zticks([]) | |
| ax.elev = -55 | |
| ax.azim = 0 | |
| # ax.dist = 8.0 | |
| print(ct) | |
| ct += 1 | |
| ct1 -= 1 | |
| return () | |
| def init() : | |
| return() | |
| o = 1 | |
| if o == 1 : | |
| anim = animation.FuncAnimation(fig, update, init_func=init, blit = True, frames=fr, repeat = False) | |
| sf = "_Sketectika.gif" | |
| Sname1 = "C://Users//Rober//Desktop//_" + sf | |
| anim.save(Sname1, writer="ffmpeg", fps=12, bitrate= 100000) | |
| else : | |
| update() | |
      
      
  Author
  
  
        
      
            Especuloide
  
      
      
      commented 
        Jul 14, 2022 
      
    
  

  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment