Last active
September 17, 2024 09:16
-
-
Save jonocarroll/f96aa0fbd61e83535ef39d82dbea3d8c to your computer and use it in GitHub Desktop.
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
ts=0.07;ps=0.02;A=B=0; | |
while(1){ j=i=0;z=rep(0,1760); | |
b=rep(' ',1760); while(j < 6.28){ | |
j=j+ts;i=0;while(i<6.28){i=i+ps;c= | |
sin(i);l=cos(i); d=cos(j);f=sin(j); | |
e=sin(A);g=cos(A );h=d+2;D=1/(c*h*e+ | |
f*g+5);m=cos(B) ;n=sin(B);t=c*h*g- | |
f*e;x=as.integer (40+30*D*(l*h*m-t*n)); | |
y=as.integer(12+ 15*D*(l*h*n+t*m)); | |
o=as.integer(x+( 80*y));N=as.integer( | |
8*((f*e-c*d*g)*m- c*d*e-f*g-l*d*n));st= | |
c('.',',','-','~', ':',';','=','!','*', | |
'#','$','@');if(22> y&&y>0&&80 >x&&x>0&& | |
D>z[o]){z[o]=D;b[o]=st[ifelse(N>0,N,1)]}}}; | |
lines=apply(matrix(b,ncol=80,byrow=T),1, | |
paste,collapse="");cat("\014");cat( | |
'\x1b[H');for(ll in seq_along( | |
lines)){cat(lines[ll],"\n")} | |
A=A+0.04;B=B+0.02} |
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
donut <- function(frames=Inf) { | |
ts <- 0.07 | |
ps <- 0.02 | |
A <- 0 | |
B <- 0 | |
ff <- 0 | |
while (ff <= frames) { | |
ff <- ff + 1 | |
j <- i <- 0 | |
z <- rep(0, 1760) | |
b <- rep(' ', 1760) | |
while (j < 6.28) { | |
j <- j + ts | |
i <- 0 | |
while (i < 6.28) { | |
i <- i + ps | |
c <- sin(i) | |
l <- cos(i) | |
d <- cos(j) | |
f <- sin(j) | |
e <- sin(A) | |
g <- cos(A) | |
h <- d+2 | |
D <- 1/(c*h*e+f*g+5) | |
m <- cos(B) | |
n <- sin(B) | |
t <- c*h*g-f*e | |
x <- as.integer(40+30*D*(l*h*m-t*n)) | |
y <- as.integer(12+15*D*(l*h*n+t*m)) | |
o <- as.integer(x+(80*y)) | |
N <- as.integer(8*((f*e-c*d*g)*m-c*d*e-f*g-l*d*n)) | |
st <- c('.',',','-','~',':',';','=','!','*','#','$','@') | |
if (22 > y && y > 0 && 80 > x && x > 0 && D > z[o]) { | |
z[o] <- D | |
b[o] <- st[ifelse(N > 0, N, 1)] | |
} | |
} | |
} | |
lines <- apply(matrix(b, ncol=80, byrow = T), 1, paste, collapse = "") | |
cat("\014") | |
cat('\x1b[H') | |
for (ll in seq_along(lines)) { | |
cat(lines[ll], "\n") | |
} | |
A <- A + 0.04 | |
B <- B + 0.02 | |
} | |
} | |
donut() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment