-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
Add content for Lab 2, while loops. We are slowly settling on a format it seems. Thanks for @phy1um and as always to @camh- for lots of thought and help polishing these contents. There are a couple of preparatory commits: * Replace all `colour` strings with `color`, we are aspiring to help people code internationally and American spelling is the defacto standard for international computing. * I have added a shortlink to https://evy.dev/send for people to submit their projects anonymously if they want. * There are a few clean-ups on Lab 1 as fall out of this PR * Add links to the Evy Lab playlist * Fix a regression bug with editor cursor disappearing introduced when adding clickable links in f5f3092 This merges the following commits: * play-site: Fix regression of missing editor cursor * all: Use American spelling * lab-site: Add lab walk-through YouTube playlist * apex: Add evy.dev/send redirect * lab-site: Tweak CSS styles * lab-site: Add Lab 2 contents Makefile | 14 +-- docs/talks-and-papers.md | 9 ++ firebase/firebase.json | 13 ++- frontend/docs/builtins.html | 1 + frontend/docs/index.html | 1 + frontend/docs/spec.html | 1 + frontend/docs/syntax-by-example.html | 1 + frontend/docs/talks-and-papers.html | 21 ++++ frontend/docs/talks-and-papers.htmlf | 17 +++ frontend/docs/usage.html | 1 + frontend/lab/css/overrides.css | 25 ++-- frontend/lab/samples/intro/coords.htmlf | 2 +- frontend/lab/samples/intro/helloworld.evy | 1 + frontend/lab/samples/intro/helloworld.htmlf | 10 ++ .../lab/samples/intro/img/circles-mali.evy | 6 +- frontend/lab/samples/intro/welcome.evy | 24 +++- frontend/lab/samples/intro/welcome.htmlf | 16 ++- frontend/lab/samples/intro/worm.htmlf | 2 +- frontend/lab/samples/loops/gradient-show.evy | 8 ++ .../lab/samples/loops/gradient-show.htmlf | 49 ++++++++ frontend/lab/samples/loops/gradient.evy | 7 ++ frontend/lab/samples/loops/gradient.htmlf | 44 +++++++ frontend/lab/samples/loops/hsl-code.evy | 1 + frontend/lab/samples/loops/hsl.evy | 2 + frontend/lab/samples/loops/hsl.htmlf | 41 +++++++ .../lab/samples/loops/img/gradient-line.evy | 3 + .../lab/samples/loops/img/gradient-line.svg | 10 ++ .../lab/samples/loops/img/gradient-thick.evy | 7 ++ .../lab/samples/loops/img/gradient-thick.svg | 108 ++++++++++++++++++ frontend/lab/samples/loops/img/lines.evy | 5 + frontend/lab/samples/loops/img/lines.svg | 21 ++++ frontend/lab/samples/loops/img/target.evy | 7 ++ frontend/lab/samples/loops/img/target.gif | Bin 0 -> 18634 bytes frontend/lab/samples/loops/img/target.svg | 21 ++++ frontend/lab/samples/loops/lines-show.evy | 10 ++ frontend/lab/samples/loops/lines-show.htmlf | 42 +++++++ frontend/lab/samples/loops/lines.evy | 8 ++ frontend/lab/samples/loops/lines.htmlf | 42 +++++++ frontend/lab/samples/loops/sequence.evy | 1 + frontend/lab/samples/loops/sequence.htmlf | 75 ++++++++++++ frontend/lab/samples/loops/string.evy | 6 + frontend/lab/samples/loops/string.htmlf | 39 +++++++ frontend/lab/samples/loops/target-show.evy | 7 ++ frontend/lab/samples/loops/target-show.htmlf | 16 +++ frontend/lab/samples/loops/target.evy | 7 ++ frontend/lab/samples/loops/target.htmlf | 28 +++++ frontend/lab/samples/samples.json | 20 +++- frontend/play/css/index.css | 2 + 48 files changed, 766 insertions(+), 36 deletions(-) Pull-request: #404
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print "Hello, world! 👋🌏" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1>👋🌏 Hello World!</h1> | ||
<p> | ||
Check out the program on the right 👉.<br /> | ||
Hit <strong>Run</strong> to see the result! | ||
</p> | ||
<p>Can you change the program to print <strong>your name</strong>? ⭐</p> | ||
<p> | ||
Check out the docs for more info on the | ||
<a href="/docs/builtins.html#print" target="_blank"><code>print</code></a> command. | ||
</p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
clear "turquoise" | ||
|
||
colour "red" | ||
color "red" | ||
move 20 50 | ||
circle 30 | ||
|
||
colour "orange" | ||
color "orange" | ||
move 50 80 | ||
circle 30 | ||
|
||
colour "yellow" | ||
color "yellow" | ||
move 80 50 | ||
circle 30 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
print "Hello, world! 👋🌏" | ||
i := 1 | ||
clear | ||
while i < 130 | ||
clear | ||
move i 60 | ||
color "orange" | ||
circle 8 | ||
|
||
move 100-i 40 | ||
color "red" | ||
circle 8 | ||
|
||
move 40 i | ||
color "purple" | ||
circle 8 | ||
|
||
move 60 100-i | ||
color "gold" | ||
circle 8 | ||
|
||
i = i + 0.1 | ||
sleep 0.001 | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
<h1>👋 Welcome</h1> | ||
<p>Programming is for everyone!</p> | ||
<p> | ||
Check out the program on the right 👉.<br /> | ||
Hit <strong>Run</strong> to see the result! | ||
You don't need any special skills or background, just a willingness to learn. Anyone can do it | ||
with a little curiosity and practice. | ||
</p> | ||
<p>Can you change the program to print <strong>your name</strong>? ⭐</p> | ||
<p> | ||
Check out the docs for more info on the | ||
<a href="/docs/builtins.html#print" target="_blank"><code>print</code></a> command. | ||
Hit <strong>Run</strong> on the right 👉. <br /> | ||
That's what we'll build up to in this first lab—a bit of a whirlwind tour! | ||
</p> | ||
<p> | ||
There is also a step-by-step | ||
<a href="https://youtu.be/FBqyiU4iZNY?si=9vFayb_R2rAgEMbX" target="_blank">video guide</a> if you | ||
need help.. | ||
</p> | ||
|
||
<p>Let's get started!</p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
width 0.2 | ||
for i := range 0 100 0.2 | ||
color (hsl i+200) | ||
move i 0 | ||
line i 100 | ||
sleep 0.001 | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<h1>🌈📺 Gradient</h1> | ||
|
||
<p>Run the program to draw an animated color gradient.</p> | ||
|
||
<p> | ||
This program was created using the | ||
<a | ||
href="https://docs.evy.dev/builtins.html#line" | ||
target="_blank | ||
" | ||
><code>line</code></a | ||
> | ||
and | ||
<a | ||
href="https://docs.evy.dev/builtins.html#width" | ||
target="_blank | ||
" | ||
><code>width</code></a | ||
> | ||
commands. | ||
</p> | ||
|
||
<details class="small"> | ||
<summary><code>line</code> and <code>width</code> commands 📖</summary> | ||
<p>The following code draws a line from point <code>10 20</code> to point <code>80 50</code>:</p> | ||
|
||
<pre><code class="language-evy">width 2 | ||
move 10 20 | ||
line 80 50 | ||
</code></pre> | ||
|
||
<p>Output:</p> | ||
|
||
<img src="samples/loops/img/gradient-line.svg" alt="Line from 10 20 to 80 50" /> | ||
</details> | ||
|
||
<h2>Implementation</h2> | ||
<p>How would you go about writing this program?</p> | ||
|
||
<details class="small"> | ||
<summary>💡 Some clues</summary> | ||
<ul> | ||
<li>Break down the problem into smaller bits.</li> | ||
<li>Create a static image with line <code>width 10</code>:</li> | ||
<img src="samples/loops/img/gradient-thick.svg" alt="thick vertical lines" /> | ||
<li>Animate the lines with the <code>sleep</code> command.</li> | ||
<li>Reduce the line width, move, sleep and loop increment.</li> | ||
</ul> | ||
</details> |