Created
March 9, 2020 22:28
-
-
Save charlieroberts/ffafe42ad79aee5b739a9ce6ba77f235 to your computer and use it in GitHub Desktop.
lots and lots of hexagons
This file contains 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
// copy and paste into https://charlieroberts.github.io/marching/playground/ | |
// select all and hit ctrl+enter | |
// turn quality to 'high' if you have a nice gfx card | |
quality = 'med' | |
size = .01/4 | |
m = HexPrism( Vec2(size,size/16) ).material('green') | |
mirrors = [] | |
count = 19 | |
for( let i = 1; i < count; i++ ) { | |
m = Mirror( m ) | |
const t = (size*i)+(size*(i/count))*i | |
mirrors.push( m ) | |
} | |
march( m ) | |
.background( Vec3(0,.1,0) ) | |
.fog( .125, Vec3(0,.1,0) ) | |
.render( 'fractal.'+quality ) | |
.camera( 0,0,1.75,.25 ) | |
time = 0 | |
onframe = () => { | |
mirrors.forEach( (v,i)=> { | |
const t = (size*i)+(size*(i/count))*i | |
const phase = (.25 + sin(time) * .35) * t | |
if( i > 0 ) { | |
v.scale(1 + count/100 ) | |
v.translate( max(.0035,pow(phase,i*i)),max(.0035,pow(phase,i*i)), phase ) | |
v.rotate( 90+sin(Math.PI*time)*135, pow(t,pow(i,i)), pow(t,cos(t%.125*time)), pow(t,t/i) ) | |
} | |
}) | |
time += .001 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment