Merge branch 'ht/newline-before-EOF' into maint
[shapes.git] / examples / features / sliders.shape
blob64bf82e74953c221e3e76b16579d2eee370effc4
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 Henrik Tidefelt
17  **/
19 •rand: [newRandom (•time)]
21 pth: @defaultunit:1%C | (0cm,0cm)>(^1)--(^~1.3)<(3cm,0cm)--(^~0.5)<(1cm,3cm)--cycle
23   •page << [stroke pth]
25   c0: [stroke [circle 3bp]]
26   c1: [stroke [circle 5bp]]
28   test: \ t0 delta →
29   (
30     [[shift [pth [pth t0].length + delta].p] c0]
31     &
32     [[shift ([pth t0] + delta).p] c1]
33   )
35   •page <<
36   [[range '0 '15].foldsl
37     \ p e •st → ( p & [test 40*[random1D •st] 20cm*[random1D •st]] )
38     null
39     •rand]
43   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
44 |**  pth: [immerse [shift (4cm,0)] [] ../pth]
46   c0: [stroke [circle 3bp]]
47   c1: [stroke [circle 5bp]]
49   •page << view [] [stroke pth]
51   test: \ t0 delta →
52   (
53     [[shift view [] [pth [pth t0].length + delta].p] c0]
54     &
55     [[shift view [] ([pth t0] + delta).p] c1]
56   )
58   •page <<
59   [[range '0 '15].foldsl
60     \ p e •st → ( p & [test 40*[random1D •st] 20cm*[random1D •st]] )
61     null
62     •rand]