|
1 |
| -<App ux:Class="MyApp" ClearColor="0,0,0,1"> |
| 1 | +<App Background="#000"> |
2 | 2 | <ClientPanel>
|
3 | 3 | <JavaScript>
|
4 |
| - var Observable = require("FuseJS/Observable") |
5 |
| - |
6 |
| - exports.birds = Observable() |
7 |
| - //repeat several to show scrolling + transition |
8 |
| - for (var i=0; i < 50; ++i) { |
9 |
| - exports.birds.add({ |
10 |
| - image: "image" + (i % 9) |
11 |
| - }) |
| 4 | + var Observable = require("FuseJS/Observable"); |
| 5 | + var birds = Observable(); |
| 6 | + |
| 7 | + // repeat several to show scrolling + transition |
| 8 | + for (var i = 0; i < 50; ++i) { |
| 9 | + birds.add({image: "Assets/image" + (i % 9) + ".jpg"}); |
12 | 10 | }
|
| 11 | + |
| 12 | + module.exports = { |
| 13 | + birds: birds |
| 14 | + }; |
13 | 15 | </JavaScript>
|
14 |
| - <Image ux:Class="ZoomImage"/> |
| 16 | + |
| 17 | + <Image ux:Class="ZoomImage" /> |
15 | 18 |
|
16 |
| - <Panel ux:Name="TheViewer" Visibility="Hidden" HitTestMode="LocalBoundsAndChildren"> |
17 |
| - <SolidColor Color="0,0,0,0" ux:Name="BlockColor"/> |
| 19 | + <Panel ux:Name="theViewer" Visibility="Hidden" HitTestMode="LocalBoundsAndChildren"> |
| 20 | + <SolidColor ux:Name="blockColor" Color="#0000" /> |
18 | 21 |
|
19 | 22 | <Panel Alignment="TopRight" Padding="5" ux:Name="CloseButton" Margin="5">
|
20 |
| - <Translation Vector="1.5,-1.5,0" RelativeTo="Size" ux:Name="TheTrans"/> |
21 |
| - <Rectangle Layer="Background" Fill="1,1,1,0.8" CornerRadius="5"/> |
22 |
| - <Image File="Assets/cancel.png" Color="0,0.1,0.2,1"/> |
| 23 | + <Translation ux:Name="theTrans" Vector="1.5,-1.5,0" RelativeTo="Size" /> |
| 24 | + <Rectangle Layer="Background" Color="#fffc" CornerRadius="5" /> |
| 25 | + <Image File="Assets/cancel.png" Color="#023f" /> |
23 | 26 | <Clicked>
|
24 |
| - <Set ViewerVisible.Value="false"/> |
| 27 | + <Set viewerVisible.Value="false"/> |
25 | 28 | </Clicked>
|
26 | 29 | </Panel>
|
27 | 30 |
|
28 | 31 | <!-- reset transform -->
|
29 | 32 | <DoubleTapped>
|
30 |
| - <Set TheZoomer.Value="1"/> |
31 |
| - <Set ThePanner.Value="0,0"/> |
32 |
| - <Set TheRotater.Value="0"/> |
| 33 | + <Set theZoomer.Value="1" /> |
| 34 | + <Set thePanner.Value="0,0" /> |
| 35 | + <Set theRotater.Value="0" /> |
33 | 36 | </DoubleTapped>
|
34 | 37 |
|
35 | 38 | <!-- close when it gets small enough -->
|
36 |
| - <WhileFloat Value="{ReadProperty TheTransform.ZoomFactor}" LessThan="0.7"> |
| 39 | + <WhileFloat Value="{ReadProperty theTransform.ZoomFactor}" LessThan="0.7"> |
37 | 40 | <!-- the gestures will be active at this time, so we must explicitly cancel them -->
|
38 |
| - <CancelInteractions/> |
39 |
| - <Set ViewerVisible.Value="false"/> |
| 41 | + <CancelInteractions /> |
| 42 | + <Set viewerVisible.Value="false" /> |
40 | 43 | </WhileFloat>
|
41 | 44 |
|
42 |
| - <WhileTrue ux:Name="ViewerVisible"> |
43 |
| - <Change BlockColor.Color="0,0.1,0.2,0.8" Duration="0.2" Easing="QuadraticInOut"/> |
44 |
| - <Change TheViewer.Visibility="Visible"/> |
45 |
| - <Change TheTrans.Vector="0" Duration="0.3" Easing="QuadraticInOut"/> |
46 |
| - <PulseForward Target="ZoomTo" Direction="Backward"/> |
| 45 | + <WhileTrue ux:Name="viewerVisible"> |
| 46 | + <Change blockColor.Color="#023c" Duration="0.2" Easing="QuadraticInOut" /> |
| 47 | + <Change theViewer.Visibility="Visible" /> |
| 48 | + <Change theTrans.Vector="0" Duration="0.3" Easing="QuadraticInOut" /> |
| 49 | + <PulseForward Target="zoomTo" When="Backward" /> |
47 | 50 |
|
48 | 51 | <!-- reset transform so animation gets close to target size -->
|
49 |
| - <Set TheZoomer.Value="1" Direction="Backward"/> |
50 |
| - <Set ThePanner.Value="0,0" Direction="Backward"/> |
51 |
| - <Set TheRotater.Value="0" Direction="Backward"/> |
| 52 | + <Set theZoomer.Value="1" When="Backward" /> |
| 53 | + <Set thePanner.Value="0,0" When="Backward" /> |
| 54 | + <Set theRotater.Value="0" When="Backward" /> |
52 | 55 | </WhileTrue>
|
53 | 56 |
|
54 |
| - <ZoomGesture Target="TheTransform" Minimum="1" Maximum="3" ux:Name="TheZoom"/> |
55 |
| - <Attractor Target="TheTransform.ZoomFactor" ux:Name="TheZoomer" TimeMultiplier="2" |
56 |
| - Type="Elastic" Unit="Normalized"/> |
| 57 | + <ZoomGesture Target="theTransform" Minimum="1" Maximum="3" /> |
| 58 | + <Attractor ux:Name="theZoomer" Target="theTransform.ZoomFactor" TimeMultiplier="2" Type="Elastic" Unit="Normalized" /> |
57 | 59 |
|
58 |
| - <RotateGesture Target="TheTransform" ux:Name="TheRotate" StepDegrees="30"/> |
59 |
| - <Attractor Target="TheTransform.Rotation" ux:Name="TheRotater" TimeMultiplier="0.5" |
60 |
| - Type="Elastic" Unit="Radians"/> |
| 60 | + <RotateGesture Target="theTransform" /> |
| 61 | + <Attractor ux:Name="theRotater" Target="theTransform.Rotation" TimeMultiplier="0.5" Type="Elastic" Unit="Radians" /> |
61 | 62 |
|
62 |
| - <PanGesture Target="TheTransform" Constraint="TheViewerImage" ux:Name="ThePan"/> |
63 |
| - <Attractor Target="TheTransform.Translation" ux:Name="ThePanner" |
64 |
| - Type="Elastic" Unit="Points"/> |
| 63 | + <PanGesture Target="theTransform" Constraint="theViewerImage" /> |
| 64 | + <Attractor ux:Name="thePanner" Target="theTransform.Translation" Type="Elastic" Unit="Points" /> |
65 | 65 |
|
66 | 66 | <!-- the user might start interacting while the attractors are still running, stop that -->
|
67 | 67 | <WhileInteracting>
|
68 | 68 | <!-- Fix will be released soon -->
|
69 |
| - <Change Target="TheZoomer.IsEnabled" Value="false"/> |
70 |
| - <Change Target="TheRotater.IsEnabled" Value="false"/> |
71 |
| - <Change Target="ThePanner.IsEnabled" Value="false"/> |
| 69 | + <Change Target="theZoomer.IsEnabled" Value="false" /> |
| 70 | + <Change Target="thePanner.IsEnabled" Value="false" /> |
| 71 | + <Change Target="theRotater.IsEnabled" Value="false" /> |
72 | 72 | </WhileInteracting>
|
73 | 73 |
|
74 | 74 | <!-- A wrapping panel to ensure the InteractiveTransform and layout transforms don't
|
75 | 75 | interfere with each other (it is not supported to have them both on the same node) -->
|
76 | 76 | <Panel>
|
77 |
| - <ZoomImage ux:Name="TheViewerImage"> |
78 |
| - <InteractiveTransform ux:Name="TheTransform"/> |
| 77 | + <ZoomImage ux:Name="theViewerImage"> |
| 78 | + <InteractiveTransform ux:Name="theTransform" /> |
79 | 79 | </ZoomImage>
|
80 |
| - <Timeline ux:Name="ZoomTo"> |
81 |
| - <Move RelativeTo="PositionOffset" Vector="1" Duration="0.3" ux:Name="ZoomToPos" |
82 |
| - Easing="QuadraticInOut"/> |
83 |
| - <Resize RelativeTo="Size" Vector="1" Duration="0.3" ux:Name="ZoomToSize" |
84 |
| - Easing="QuadraticInOut"/> |
| 80 | + <Timeline ux:Name="zoomTo"> |
| 81 | + <Move ux:Name="zoomToPos" RelativeTo="PositionOffset" Vector="1" Duration="0.3" Easing="QuadraticInOut" /> |
| 82 | + <Resize ux:Name="zoomToSize" RelativeTo="Size" Vector="1" Duration="0.3" Easing="QuadraticInOut" /> |
85 | 83 | </Timeline>
|
86 | 84 | </Panel>
|
87 | 85 | </Panel>
|
88 | 86 |
|
89 |
| - <ScrollView AllowedScrollDirections="Horizontal" ux:Name="TheScroll"> |
| 87 | + <ScrollView ux:Name="theScroll" AllowedScrollDirections="Horizontal"> |
90 | 88 | <Panel Margin="7">
|
91 |
| - <ColumnLayout ColumnSize="100" Orientation="Horizontal" Sizing="Fill" |
92 |
| - ColumnSpacing="7" ItemSpacing="7" ux:Name="TheColumns"/> |
| 89 | + <ColumnLayout ux:Name="theColumns" ColumnSize="100" Orientation="Horizontal" Sizing="Fill" ColumnSpacing="7" ItemSpacing="7" /> |
93 | 90 |
|
94 | 91 | <Each Items="{birds}">
|
95 |
| - <Panel ux:Name="self"> |
96 |
| - <Image Source="{DataToResource image}" ux:Name="selfImage"/> |
| 92 | + <Panel> |
| 93 | + <Image ux:Name="selfImage" File="{image}" /> |
97 | 94 | <Tapped>
|
98 |
| - <Set Target="TheViewerImage.Source" Value="{DataToResource image}"/> |
99 |
| - <Set ViewerVisible.Value="true"/> |
| 95 | + <Set Target="theViewerImage.File" Value="{image}" /> |
| 96 | + <Set viewerVisible.Value="true" /> |
100 | 97 |
|
101 |
| - <Set TheTransform.ZoomFactor="1"/> |
102 |
| - <Set TheTransform.Rotation="0"/> |
103 |
| - <Set TheTransform.Translation="0"/> |
| 98 | + <Set theTransform.ZoomFactor="1" /> |
| 99 | + <Set theTransform.Rotation="0" /> |
| 100 | + <Set theTransform.Translation="0" /> |
104 | 101 |
|
105 |
| - <Set ZoomToPos.RelativeNode="selfImage"/> |
106 |
| - <Set ZoomToSize.RelativeNode="selfImage"/> |
107 |
| - <PulseBackward Target="ZoomTo"/> |
| 102 | + <Set zoomToPos.RelativeNode="selfImage" /> |
| 103 | + <Set zoomToSize.RelativeNode="selfImage" /> |
| 104 | + <PulseBackward Target="zoomTo" /> |
108 | 105 | </Tapped>
|
109 | 106 | </Panel>
|
110 | 107 | </Each>
|
|
113 | 110 | </ScrollView>
|
114 | 111 |
|
115 | 112 | <WhileWindowPortrait>
|
116 |
| - <Change TheScroll.AllowedScrollDirections="Vertical"/> |
117 |
| - <Change TheColumns.Orientation="Vertical"/> |
| 113 | + <Change theScroll.AllowedScrollDirections="Vertical" /> |
| 114 | + <Change theColumns.Orientation="Vertical" /> |
118 | 115 | </WhileWindowPortrait>
|
119 | 116 | </ClientPanel>
|
120 | 117 |
|
121 |
| - <!-- a few with different aspect ratios --> |
122 |
| - <FileImageSource ux:Key="image0" File="Assets/Unsplash2.jpg"/> |
123 |
| - <FileImageSource ux:Key="image1" File="Assets/Unsplash20.jpg"/> |
124 |
| - <FileImageSource ux:Key="image2" File="Assets/Unsplash21.jpg"/> |
125 |
| - <FileImageSource ux:Key="image3" File="Assets/Unsplash3.jpg"/> |
126 |
| - <FileImageSource ux:Key="image4" File="Assets/Unsplash5.jpg"/> |
127 |
| - <FileImageSource ux:Key="image5" File="Assets/Unsplash6.jpg"/> |
128 |
| - <FileImageSource ux:Key="image6" File="Assets/Unsplash10.jpg"/> |
129 |
| - <FileImageSource ux:Key="image7" File="Assets/Unsplash11.jpg"/> |
130 |
| - <FileImageSource ux:Key="image8" File="Assets/Unsplash13.jpg"/> |
131 | 118 | </App>
|
0 commit comments