Skip to content

Commit 5dbb1cf

Browse files
authored
Merge pull request #38 from easycoder/dev
Rework demos
2 parents 191d27d + 2e4b5d1 commit 5dbb1cf

26 files changed

+99
-1
lines changed

demos/dice/index.html

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5+
<title></title>
6+
</head>
7+
8+
<body>
9+
10+
<pre id="easycoder-script" style="display:none">!
11+
12+
! Twin dice roller
13+
14+
script DiceRoller
15+
16+
div Screen
17+
div Dice
18+
div Dot
19+
variable NDice
20+
variable M
21+
variable N
22+
variable D
23+
variable Index
24+
variable Row
25+
variable Dots
26+
variable Patterns
27+
variable Left
28+
variable Top
29+
30+
put 2 into NDice
31+
set style `.ec-dice` to `{width:100px;height:100px;margin:20px;`
32+
cat `background:yellow;border:1px solid black;display:inline-block;`
33+
cat `position:relative}`
34+
set style `.ec-dot` to `{width:20px;height:20;position:absolute;`
35+
cat `background:black;border-radius:10px}`
36+
37+
set Patterns to
38+
40 40 0 0 0 0 0 0 0 0 0 0
39+
10 40 70 40 0 0 0 0 0 0 0 0
40+
10 40 40 40 70 40 0 0 0 0 0 0
41+
10 10 70 10 10 70 70 70 0 0 0 0
42+
10 10 70 10 10 70 70 70 40 40 0 0
43+
10 10 10 70 40 10 40 70 70 10 70 70
44+
45+
create Screen
46+
set the style of Screen to `padding:1em`
47+
set the elements of Dice to NDice
48+
49+
Redraw:
50+
put 0 into M
51+
while M is less than 10
52+
begin
53+
put 0 into N
54+
while N is less than NDice
55+
begin
56+
index Dice to N
57+
remove element Dice
58+
create Dice in Screen
59+
set the class of Dice to `ec-dice`
60+
gosub to RandomiseDots
61+
add 1 to N
62+
end
63+
wait 10 ticks
64+
add 1 to M
65+
end
66+
on click Dice go to Redraw
67+
stop
68+
69+
RandomiseDots:
70+
put random 6 into Dots
71+
multiply Dots by 12 giving Row
72+
put 0 into D
73+
while D is less than 12
74+
begin
75+
add D to Row giving Index
76+
index Patterns to Index
77+
put Patterns into Top
78+
add 1 to D
79+
if Top is not 0
80+
begin
81+
add 1 to Index
82+
index Patterns to Index
83+
put Patterns into Left
84+
create Dot in Dice
85+
set the class of Dot to `ec-dot`
86+
set style `top` of Dot to Top
87+
set style `left` of Dot to Left
88+
on click Dot go to Redraw
89+
end
90+
add 1 to D
91+
end
92+
return
93+
</pre>
94+
95+
<script type='text/javascript' src='https://cdn.jsdelivr.net/gh/easycoder/easycoder.github.io/dist/easycoder.js?v=200413'></script>
96+
97+
</body>
98+
</html>

storyteller/index.html renamed to demos/storyteller/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<body>
99

1010
<pre id="storyteller-branch" style="display:none">dev</pre>
11-
<pre id="storyteller-stories" style="display:none">storyteller</pre>
11+
<pre id="storyteller-stories" style="display:none">stories</pre>
1212
<pre id="easycoder-script" style="display:none">
1313

1414
script Boot

0 commit comments

Comments
 (0)