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
// use pax::*;
// use pax::api::{EasingCurve, ArgsRender, ArgsClick};
// use pax_std::primitives::{Text, Rectangle, Group};
// use pax_std::components::{Stacker};
//
// #[pax_root(
//     //Fill screen with ten even columns
//     <Stacker cell_count=10 >
//
//         //First column: split into five rows
//         <Stacker cells=5 direction=Vertical >
//             for i in 0..5 {
//                 <Rectangle fill={
//                     rgb((i * 20)%, 0, 100%)
//                 }/>
//             }
//         </Stacker>
//
//         //Middle eight columns
//         for i in 0..8 {
//             <Group>
//                 <Text id=index_text>{i}</Text>
//                 <Rectangle fill={
//                     rgb(100%, (100 - (i * 12.5))%,(i * 12.5)%)
//                 }/>
//             </Group>
//         }
//
//         //Final column: clickable, animated
//         <Group @click=self.handle_click transform={rotate(self.current_rotation)}>
//             <Text>{JABBERWOCKY}</Text>
//             <Rectangle fill={rgb(100%, 100%, 0)} />
//         </Group>
//
//     </Stacker>
//
//     @settings {
//         #index_text {
//             transform: { align(0%, i * 12.5%) }
//             font: {
//                 family: "Real Text Pro",
//                 variant: "Demibold",
//                 size: {(20 + (i * 5))px},
//             }
//             fill: {rgb(0,0,0)}
//         }
//     }
// )]
// pub struct Jabberwocky {
//     pub num_clicks : Property<i64>,
//     pub current_rotation: Property<f64>,
// }
//
// impl Jabberwocky {
//
//     #[pax_on(WillRender)]
//     pub fn handle_will_render(&mut self, args: ArgsRender) {
//         if args.frames_elapsed % 180 == 0 {
//             //every 3s
//             pax::log(&format!("pax::log from frame {}", args.frames_elapsed));
//         }
//     }
//
//     pub fn handle_click(&mut self, args: ArgsClick) {
//         let new_rotation = self.current_rotation.get() + (2.0 * std::f64::consts::PI);
//         self.current_rotation.ease_to(new_rotation, 120, EasingCurve::InOutBack );
//         self.current_rotation.ease_to_later(0.0, 40, EasingCurve::OutBack );
//     }
// }
//
// const JABBERWOCKY : &str = r#"’Twas brillig, and the slithy toves
// Did gyre and gimble in the wabe:
// All mimsy were the borogoves,
// And the mome raths outgrabe.
//
// “Beware the Jabberwock, my son!
// The jaws that bite, the claws that catch!
// Beware the Jubjub bird, and shun
// The frumious Bandersnatch!”
//
// He took his vorpal sword in hand;
// Long time the manxome foe he sought—
// So rested he by the Tumtum tree
// And stood awhile in thought.
//
// And, as in uffish thought he stood,
// The Jabberwock, with eyes of flame,
// Came whiffling through the tulgey wood,
// And burbled as it came!
//
// One, two! One, two! And through and through
// The vorpal blade went snicker-snack!
// He left it dead, and with its head
// He went galumphing back.
//
// “And hast thou slain the Jabberwock?
// Come to my arms, my beamish boy!
// O frabjous day! Callooh! Callay!”
// He chortled in his joy.
//
// ’Twas brillig, and the slithy toves
// Did gyre and gimble in the wabe:
// All mimsy were the borogoves,
// And the mome raths outgrabe.
// "#;
//