Improvements to namespaces and file inclusion
[shapes.git] / examples / features / sliders.shape
blob68af8b2e7de3adf0dcc75458f5df9337b134c76d
1 /** This file is part of Shapes.
2  **
3  ** Shapes is free software: you can redistribute it and/or modify
4  ** it under the terms of the GNU General Public License as published by
5  ** the Free Software Foundation, either version 3 of the License, or
6  ** any later version.
7  **
8  ** Shapes is distributed in the hope that it will be useful,
9  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  ** GNU General Public License for more details.
12  **
13  ** You should have received a copy of the GNU General Public License
14  ** along with Shapes.  If not, see <http://www.gnu.org/licenses/>.
15  **
16  ** Copyright 2008, 2014 Henrik Tidefelt
17  **/
19 ##lookin ..Shapes
21 •rand: [newRandom (•time)]
23 pth: @defaultunit:1%C | (0cm,0cm)>(^1)--(^~1.3)<(3cm,0cm)--(^~0.5)<(1cm,3cm)--cycle
25   •page << [stroke pth]
27   c0: [stroke [circle 3bp]]
28   c1: [stroke [circle 5bp]]
30   test: \ t0 delta →
31   (
32     [[shift [pth [pth t0].length + delta].p] c0]
33     &
34     [[shift ([pth t0] + delta).p] c1]
35   )
37   •page <<
38   [[range '0 '15].foldsl
39     \ p e •st → ( p & [test 40*[random1D •st] 20cm*[random1D •st]] )
40     null
41     •rand]
45   pth: @defaultunit:1%C | (4cm,0cm,0cm)>(5cm,0cm,1cm)--(3cm,1cm,0cm)<(7cm,0cm,2cm)--(5.5cm,1.5cm,~1cm)<(5cm,3cm,~1cm)--cycle
46 |**  pth: [immerse [shift (4cm,0)] [] ../pth]
48   c0: [stroke [circle 3bp]]
49   c1: [stroke [circle 5bp]]
51   •page << view [] [stroke pth]
53   test: \ t0 delta →
54   (
55     [[shift view [] [pth [pth t0].length + delta].p] c0]
56     &
57     [[shift view [] ([pth t0] + delta).p] c1]
58   )
60   •page <<
61   [[range '0 '15].foldsl
62     \ p e •st → ( p & [test 40*[random1D •st] 20cm*[random1D •st]] )
63     null
64     •rand]