File: test.bs

package info (click to toggle)
storm-lang 0.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,028 kB
  • sloc: ansic: 261,471; cpp: 140,432; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (117 lines) | stat: -rw-r--r-- 2,789 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
use presentation;
use presentation:graph;
use ui;
use core:geometry;
use core:io;
use graphics;
use layout;
use lang:bs:macro;

Url resUrl() {
	if (u = named{res}.url) {
		u;
	} else {
		Url();
	}
}

// A 'style' used in a picture...
void myBox(Node n) on Render {
	n.margin(10, 10);
}

presentation Test "Test presentation" {
	Font font("Arial", 32);

	animationTime = 500 ms;

	background Stack {
		SolidFill white {}
		anchor southEast {
			pageNumber {}
		}
	}

	slide FadeIn => title "Test presentation", "My name here!" {}

	slide FadeIn => content "Testing!" {
		SolidFill green {}
	}

	slide SlideDown false => columns "Two columns!" {
		SolidFill green { @1, 1 s: FadeIn; }
		SolidFill blue { @1 +500 ms, 1 s: FadeIn; }
	}

	slide SlideDown false => content "Drawn pictures!" {
		picture {
			picture.scale = 1;

			a = rectangle { myBox; text: "Hello!"; fillColor: red; }
			b = rectangle { east: 0 of a; myBox; text: "World!"; fillColor: green; }
			node { south: 0 of b.southWest; text: "I am below!"; }

			r = rectangle { myBox; rounded: 10; text: "Above!"; north: 20 of a.northEast; }
			ca = circle { text: "23"; north: 20 of r.northWest - Size(60, 0); }
			cb = circle { oval; text: "Longer"; north: 20 of r.northEast + Size(60, 0); fillColor: green + blue; }
			cd = rectangle { myBox; text: "Above"; north: 100 of r; @1, 1s: FadeIn; }

			edge ca, cb { bendLeft: 0.1; toArrow: PlainArrow; @3: Show; }
			edge cd, cb { fromArrow: TriangleArrow; toArrow: PlainArrow; }
			edge ca, cd { fromArrow: FancyArrow; toArrow: FancyArrow; @2, 1s: FadeIn; }
		}
	}

	slide SlideDown true => columns "Text as well!" {
		par "A single long paragraph in this column." {}
		Stack {
			SolidFill green {}
			list ["Second column!", "Contains a list!", "Of nice elements!"] {}
		}
	}

	slide SlideDown false => columns "Various lists..." {
		list ["Unordered list", "Foo", "Bar", "Baz"] {}
		Stack {
			SolidFill green {}
			list ["Ordered list", "Foo", "Bar", "Baz"] { ordered; }
		}
	}

	slide SlideDown false => content "Image!" {
		image resUrl / "flower-raw.ppm" { fit; }
	}

	slide Enlarge => Grid {
	expandCol: 0;
	expandCol: 1;
	expandRow: 1;
		Heading "Neat colored boxes!", font, black { colspan: 2; }
		nextLine;
		SolidFill RadialGradient(red, white, Point(320, 240), 300) {}
		SolidFill RadialGradient(green, white, Point(320, 240), 300) {}
	}

	slide Enlarge => content "Bar graphs!" {
		barGraph {
		labels: ["A", "B", "C", "D"];
		ticks: 0, 10, 40;
		data: [10, 20, 30, 8], red;
		data: [12, 14, 40, 10], green;
		dataLabels: (x) => "${x}%";

		@1: ShowLabel 1;
		@1+400ms: ShowLabel 2;
		@2: HideLabel 1;
		@3: ShowLabel 3;
		@4: HideLabel 3;
		}
	}
}


// Main entry-point for testing.
void test() {
	// export(Test, cwdUrl / ".." / "presentation.pdf");
	Test.show();
}