Skip to content

Commit 11aa233

Browse files
authored
Displays animated pattern.
1 parent 9501e48 commit 11aa233

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

compound_eye.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Intro: Displays animated pattern.
2+
# Source: http://code-poetry.com/compound_eye
3+
4+
c,q,g,p=1.45,0.5,
5+
0.25,0.25;v=->x,t,s{
6+
a,j=(x-c).abs,(t-q).abs
7+
return j>p||a>2*g ? 0: (s*
8+
-(2*p*g-p*a-g*j)).to_i+s;};(
9+
1..1000).map{|m|;s="\n " ; (
10+
0..21).map{|t|;(0..74). map{
11+
|x|;d=v[x/25.0,t/21.0, m];
12+
s+=' .:-=+*&#%@'[d%11]};
13+
s+="\n "};sleep(0.02
14+
);puts(s);'.:-=+*&'}

0 commit comments

Comments
 (0)