x
 
1
// Welcome to the BrowserSynth editor v 0.1
2
//
3
// You can write some sytructure synth code right here and see the results
4
// Once you press "Hide Code" you can use the mouse buttons to manipulate the object
5
// Left button rotates, right moves and wheel zooms.
6
//
7
// Click the 3 lines and you can chose from a couple of examples.
8
// The share button encodes the current script into the URL line so you can just post
9
// and the script is included.
10
//
11
// Save enables you to save the current scipt and download it to your computer as a text file.
12
//
13
// At the moment syntax errors are only shown in the javascript console.
14
15
// Give it a try!!
16
17
{y 4 }all
18
{y -3 rx 20 color blue}all
19
{y -9 z 4  rx -45 color orange}all
20
21
rule all{
22
 // pentagons
23
 {y 3 x 2}penta
24
25
 //f stands for frame
26
 {y 3 x 4}fpenta
27
28
 //ft stands for twisted frame
29
 {y 3 x 6} ftpenta
30
31
 // hexagons
32
 {y 3 x -2}hexa
33
 {y 3 x -4}fhexa
34
 {y 3 x -6} fthexa
35
36
 // boxes
37
 {y 3 x -10}box
38
 {y 3 x -12}fbox
39
 {y 3 x -14} ftbox
40
41
 // polyhedrons
42
 {y 3 x 10}tetra
43
 {y 3 x 12}octa
44
 {y 3 x 14}icosa 
45
46
 {x -8}box
47
 {x -6}sphere
48
 {x -4}torus
49
 {x -1}cylinder
50
 {x 3}pyra3
51
 {x 5}pyra4
52
 {x 7}cone
53
54
// those two are CSG elements
55
// using CSG speeds up rendering a lot 
56
// and reduces the number of objects
57
 {x 10}frame
58
 {x 13}crossframe
59
60
// those 3 elements can be used to create a marble as you can find in the example scripts
61
 {x -11}straightrun
62
 {x -14}cornerrun
63
 {x -16 y 1} uprun
64
}