Skip to content

Commit 4a9a1c0

Browse files
authored
Merge pull request #684 from awang040403/awang040403-issue-224
224: Chinese localization for example
2 parents ff05ab2 + f5c6aa8 commit 4a9a1c0

5 files changed

Lines changed: 120 additions & 0 deletions

File tree

static/examples/zh-CN/ASCII.wp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ASCII码视频
2+
===
3+
colors: Camera(20px 20px 100ms)
4+
scale: "@%#*+=-:. " → []
5+
6+
Stage(
7+
colors.combined(
8+
[]
9+
ƒ(phrases•[Phrase] row•[Color] y•#)
10+
phrases.append(
11+
row.translate(
12+
ƒ(color•Color x•#)
13+
Phrase(
14+
"\scale[(color.lightness · 9).round()]\"
15+
place: Place((-x - 1) · 0.5m y · -0.5m)
16+
duration: 0s
17+
size: 0.75m
18+
face: "Noto Sans Mono"
19+
)
20+
)
21+
)
22+
)
23+
description: "20 by 20 video stylized with ASCII"
24+
)

static/examples/zh-CN/Adventure.wp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
冒险
2+
=== 开始/zh-CN
3+
•State(action•"" description•[""] options•[State] won•?)
4+
5+
stand: State('站立' ["你站不起来,你被束缚住了。"] [] ⊥)
6+
cut: State('自我解脱' [ "你已经解脱了。"] [] ⊤)
7+
throw: State('扔掉' [ "你扔了刀。"] [stand] ⊥)
8+
pickup: State('拾起' ['你有一把刀。'] [ cut throw ] ⊥)
9+
roll: State('翻滚' ['你身边有一把刀。'] [ pickup stand ] ⊥)
10+
start: State("开始" ["你醒来在一间黑暗冷冽的房间里。"] [ roll stand ] ⊥)
11+
12+
key: Key()
13+
14+
¶start at the state state, and if the key changes, either go to start if there are no options, stay if the key isn't valid, or choose the option.¶
15+
state•State:
16+
start … ∆ key …
17+
state.won ? start
18+
state.options.length() = 0 ? start
19+
~((key = '1') | (key = '2')) ? state
20+
state.options[key → #]
21+
22+
options:
23+
state.won ? [ Phrase(`*你自由了!*`) ]
24+
(state.options.length() = 0) ? [ Phrase(`*重新开始!*`) ]
25+
state.options.translate(ƒ(option•State index•#) Phrase(`\index\. *\option.action\*` size: 2m name: option.action duration: 1s entering: Pose(opacity: 0%)))
26+
27+
28+
Stage(
29+
[
30+
Group(
31+
Stack()
32+
[
33+
Phrase(state.description duration: 0.5s name: state.action entering: Pose(offset: Place(0m 2m)))
34+
:options
35+
]
36+
)
37+
]
38+
background: Color(0 0 0°)
39+
color: Color(100% 0 0°)
40+
face: "Permanent Marker"
41+
)

static/examples/zh-CN/Amplitude.wp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
振幅
2+
===
3+
amplitudes•[#]: ←← 10 Volume()
4+
vis: amplitudes.translate(ƒ (amp•#) Phrase("⚫️" opacity: amp size: 10m))
5+
Stage([Group( Row() vis )] place: Place(0m 0m -50m))
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
篮球之星
2+
=== 开始
3+
click: ∆ Button()
4+
5+
clickCount: 0 … click … 1 + .
6+
7+
basketballPlace: (clickCount % 2) = 0 ? Place(x: Pointer().x y: 8m z: 0m) Motion(place: Place(0m 8m 0m))
8+
9+
basketball: Phrase(
10+
"🏀" 0.7m
11+
matter: Matter(0.623kg 0.99)
12+
place: basketballPlace
13+
name: "篮球"
14+
)
15+
16+
¶ 每次投篮时随机确定篮筐位置 ¶
17+
basketXPlace: Random(-9000m 9000m) ÷ 1000 … (click & ((clickCount % 2) = 1)) … Random(-9000m 9000m) ÷ 1000
18+
19+
¶ 记录得分和尝试次数 ¶
20+
¶ 记录得分和尝试次数 ¶
21+
score: 0 … (click & ((clickCount % 2) = 1) & ((basketXPlace + 0.81m) > (basketball.place ?? Place()).x) & ((basketXPlace - 0.8m) < (basketball.place ?? Place()).x)) & (2.1m > (basketball.place ?? Place()).y) … 1 + .
22+
23+
attempt: (clickCount ÷ 2).roundUp()
24+
25+
basketballStar: Group(Stack() [
26+
Phrase("篮球" offset: Place(0m 2m 0m))
27+
Phrase("之星" offset: Place(0m 1m 0m))
28+
Phrase("得分: " + score → '' offset: Place(0m -4.5m 3m))
29+
Phrase("尝试次数: " + attempt → '' offset: Place(0m -5m 3m))
30+
] size: 2m face: "Sue Ellen Francisco" offset: Place(0m 4m 10m))
31+
32+
Stage(
33+
[
34+
basketball
35+
Shape(Rectangle(-1m + basketXPlace 0.1m 1m + basketXPlace 0m 0m) background: Color(60% 100 30°))
36+
Shape(Rectangle(0.9m + basketXPlace 2m 1m + basketXPlace 0m 0m) background: Color(60% 100 30°))
37+
Shape(Rectangle(-1m + basketXPlace 2m -0.9m + basketXPlace 0m 0m) background: Color(60% 100 30°))
38+
Shape(Rectangle(-10m 0.01m 10m -2m))
39+
basketballStar
40+
]
41+
place: Place(x: 0m y: 5m z: -10m)
42+
gravity: 5m/s^2
43+
)

static/examples/zh-CN/Between.wp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
之间
2+
=== 开始/zh
3+
¶如果 n 介于最小值和最大值之间,则为真,不包括最小值和最大值。¶
4+
ƒ between(n•# min•# max•#) (n > min) & (n < max)
5+
6+
¶让我们来测试一下!¶
7+
between(1 0 5)

0 commit comments

Comments
 (0)