Skip to content

Commit 6f4ee14

Browse files
committed
Adding section 4.1 on animations
1 parent 755a0a4 commit 6f4ee14

File tree

2 files changed

+70
-6
lines changed

2 files changed

+70
-6
lines changed

index.html

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ <h4 class="exercise-start">
940940
<h2 id="nativescript-modules">NativeScript modules</h2>
941941
<p>Explain what modules are. Should be able to copy content almost verbatim from the current guide.</p>
942942
<h3 id="ui-elements">UI elements</h3>
943-
<p>Explain that UI elements are actually NativeScript modules.</p>
943+
<p>Explain that UI elements are actually NativeScript modules. Say that we’re going to make this app look nice—it’s a native app after all.</p>
944944
<h4 class="exercise-start">
945945
<b>Exercise</b>: ???
946946
</h4>
@@ -967,11 +967,35 @@ <h4 class="exercise-start">
967967
</blockquote>
968968
<div class="exercise-end"></div>
969969

970-
<p>Explain what <code>OnInit</code> is. Explain how to look up {N} modules on the docs. Show images of what the app looks like now. Transition to talking about the list page.</p>
970+
<p>Explain what <code>OnInit</code> is. Explain how to look up {N} modules on the docs. Show images of what the app looks like now.</p>
971+
<p>Transition to animations</p>
972+
<h3 id="animations">Animations</h3>
973+
<p>Talk about animations and the animation module.</p>
974+
<h4 class="exercise-start">
975+
<b>Exercise</b>: ???
976+
</h4>
977+
978+
<p>Open <code>app/pages/login/login.html</code> and add an <code>id</code> to the <code>&lt;StackLayout&gt;</code>:</p>
979+
<pre><code class="lang-XML">&lt;StackLayout id=&quot;container&quot;&gt;
980+
</code></pre>
981+
<p>Open <code>app/pages/login/login.component.ts</code> and add the following line at the top:</p>
982+
<pre><code class="lang-TypeScript">import {Color} from &quot;color&quot;;
983+
</code></pre>
984+
<p>Change the <code>toggleDisplay()</code> function in the same file to look like this:</p>
985+
<pre><code class="lang-TypeScript">toggleDisplay() {
986+
this.isLoggingIn = !this.isLoggingIn;
987+
this.page.getViewById(&quot;container&quot;).animate({
988+
backgroundColor: this.isLoggingIn ? new Color(&quot;white&quot;) : new Color(&quot;#301217&quot;),
989+
duration: 200
990+
});
991+
}
992+
</code></pre>
993+
<div class="exercise-end"></div>
994+
995+
<p>Talk about the color module and animation module. Have gifs. Mention that the hint color looks bad, but that we’ll address that later. Transition to talking about the list page.</p>
971996
<h3 id="listview">ListView</h3>
972997
<h3 id="gridlayout">GridLayout</h3>
973998
<h3 id="activityindicator">ActivityIndicator</h3>
974-
<h3 id="animations">Animations</h3>
975999

9761000
</div>
9771001
<div class="chapter">

src/chapters/chapter4.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Explain what modules are. Should be able to copy content almost verbatim from th
44

55
### UI elements
66

7-
Explain that UI elements are actually NativeScript modules.
7+
Explain that UI elements are actually NativeScript modules. Say that we’re going to make this app look nice—it’s a native app after all.
88

99
<h4 class="exercise-start">
1010
<b>Exercise</b>: ???
@@ -43,12 +43,52 @@ ngOnInit() {
4343
4444
<div class="exercise-end"></div>
4545

46-
Explain what `OnInit` is. Explain how to look up {N} modules on the docs. Show images of what the app looks like now. Transition to talking about the list page.
46+
Explain what `OnInit` is. Explain how to look up {N} modules on the docs. Show images of what the app looks like now.
47+
48+
Transition to animations
49+
50+
### Animations
51+
52+
Talk about animations and the animation module.
53+
54+
<h4 class="exercise-start">
55+
<b>Exercise</b>: ???
56+
</h4>
57+
58+
Open `app/pages/login/login.html` and add an `id` to the `<StackLayout>`:
59+
60+
``` XML
61+
<StackLayout id="container">
62+
```
63+
64+
Open `app/pages/login/login.component.ts` and add the following line at the top:
65+
66+
``` TypeScript
67+
import {Color} from "color";
68+
```
69+
70+
Change the `toggleDisplay()` function in the same file to look like this:
71+
72+
``` TypeScript
73+
toggleDisplay() {
74+
this.isLoggingIn = !this.isLoggingIn;
75+
this.page.getViewById("container").animate({
76+
backgroundColor: this.isLoggingIn ? new Color("white") : new Color("#301217"),
77+
duration: 200
78+
});
79+
}
80+
```
81+
82+
<div class="exercise-end"></div>
83+
84+
Talk about the color module and animation module. Have gifs. Mention that the hint color looks bad, but that we’ll address that later. Transition to talking about the list page.
4785

4886
### ListView
4987

5088
### GridLayout
5189

5290
### ActivityIndicator
5391

54-
### Animations
92+
93+
94+

0 commit comments

Comments
 (0)