-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
solidgeometry.fl
43 lines (40 loc) · 1.96 KB
/
solidgeometry.fl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
-- This example will be initially very jittery as it caches the generated
-- models. Note the use of the `stepped()` function to limit the number of
-- cached models to a number that keeps the animation reasonably smooth while
-- avoiding doing too much model generation.
%pragma tempo 60
func stepped(x, n=100)
x*n // 1 / n
!window size=1080
!record filename=OUTPUT
!canvas3d samples=4 viewpoint=0;0;20 near=1 far=50
!light color=0.1
!light color=0.9 direction=1;0;-1
let t=2+beat -- offset for capturing an interesting static image
!transform rotate=t/30;t/20;t/30
let n=12
for i in ..n
let r=2.05+0.7*stepped(sine(t/10+i/n))
!material color=hsv(i/n+t/30;1;1)
!transform rotate_y=i/n translate=0;0;10
!trim origin=0;1;0 normal=0;1;1
if i % 2 == 0
!intersect
!box size=4
!sphere segments=64 size=r
else
!difference
!box size=4
!sphere segments=64 size=r
!union color=0.5 roughness=0.3
!trim origin=0;1;0 normal=0.75;1;0
!difference
!box size=4;2;4
!transform translate=0;-0.25;0
!trim origin=0;1;0 normal=0.75;1;0
!box size=3.5;2;3.5
!difference
!cylinder size=0.75;0.75;2 rotation=0.25;0;0
!cylinder size=0.5;0.5;2 rotation=0.25;0;0
for i in (-1;1)
!cylinder size=0.75 position=-1;1.125;i rotation=0.25;0;0