Skip to content

Instantly share code, notes, and snippets.

@charlieroberts
Created March 11, 2020 19:24
Show Gist options
  • Save charlieroberts/dd838e2bec5a41d8ad3ab9efbc1a4906 to your computer and use it in GitHub Desktop.
Save charlieroberts/dd838e2bec5a41d8ad3ab9efbc1a4906 to your computer and use it in GitHub Desktop.
A Julia set rotating through a twist
// copy and paste into https://charlieroberts.github.io/marching/playground/
// select all and hit ctrl+enter
mat1 = Material( 'phong', .05, 1, .5 )
mat2 = Material( 'phong', 0, .1, .25 )
march(
t = Twist(
b = Julia().material( mat1 ).scale(.4),
Vec2(10)
),
p = Plane( Vec3(0,0,1), .3 ).material(mat2)
)
.light(
Light( Vec3(1,0,1.5), Vec3(.125), .4 )
)
.render('fractal.kindaclose')
.camera(0,0,1)
onframe = time => {
b.rotate( time*15, 1, 1, 0 )
b.fold = 3 + sin( time/4 ) * .25
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment