-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
189 lines (175 loc) · 11.1 KB
/
Copy pathindex.html
File metadata and controls
189 lines (175 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>ZUO Motion — Image → GML Character Motion Generator</title>
<meta name="description" content="Upload a 9-cell sprite sheet to slice it into parts, preview the motions, and download a ready-to-use GML script for GameMaker Studio 2." />
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%8E%AE%3C/text%3E%3C/svg%3E" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header class="topbar">
<div class="brand">
<span class="logo">◈</span>
<div>
<h1>ZUO Motion</h1>
<p>One image → part slicing → motion preview → GML download</p>
</div>
</div>
<a class="ghost-btn" id="githubLink" href="https://github.com/YunJuho0010/GML-Character-Rig" target="_blank" rel="noopener">
<svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>
YunJuho0010
</a>
</header>
<main class="wrap">
<!-- top CTA: the main action -->
<div class="hero">
<button class="primary big" id="downloadGmlBtn">⬇ Download GML Script</button>
</div>
<!-- STEP 1: upload -->
<section class="panel">
<h2><span class="step">1</span> Upload Image</h2>
<div class="upload-row">
<div class="upload-area" id="dropZone">
<input type="file" id="fileInput" accept="image/png,image/jpeg,image/webp" hidden />
<div class="upload-inner">
<div class="upload-icon">⬆</div>
<p><strong>Character Sheet</strong></p>
<p class="muted small">Square 3×3 sheet recommended · click/drop</p>
</div>
</div>
<div class="upload-area" id="weaponDrop">
<input type="file" id="weaponInput" accept="image/png,image/jpeg,image/webp" hidden />
<div class="upload-inner">
<div class="upload-icon">⬆</div>
<p><strong>Weapon Image</strong></p>
<p class="muted small">Optional · click/drop</p>
</div>
</div>
</div>
</section>
<!-- STEP 2: slice guide + preview (always visible) -->
<section class="panel" id="resultPanel">
<h2><span class="step">2</span> Preview</h2>
<div class="result-grid">
<!-- slice guide -->
<div class="slice-box">
<div class="sheet-wrap">
<canvas id="sheetCanvas"></canvas>
<canvas id="gridCanvas" class="grid-overlay"></canvas>
</div>
<!-- weapon shown as an extra cell below the bottom-left (left leg) cell -->
<div class="weapon-cell" id="weaponGuide">
<canvas id="weaponCanvas"></canvas>
</div>
</div>
<!-- animated preview -->
<div class="preview-box">
<div class="stage" id="stage">
<canvas id="previewCanvas" width="360" height="360"></canvas>
<div class="stage-controls top">
<div class="sc-cluster sc-motion">
<select class="motion-select" id="motionSelect" title="Motion"></select>
</div>
<div class="sc-cluster sc-sliders">
<div class="sc-row" title="Playback speed (click the number to type a value)">
<span class="sc-lbl2">Speed</span>
<input type="range" id="speedRange" min="0.2" max="3" step="0.1" value="1" />
<input type="number" id="speedVal" class="sc-val sc-num" min="0.2" max="3" step="0.1" value="1" />
</div>
<button type="button" class="sc-detail-toggle" id="detailToggle">Spacing ▾</button>
<div class="sc-detail" id="detailPanel" hidden>
<div class="sc-row" title="Head/face height (more negative = higher)">
<span class="sc-lbl2">Body/Face</span>
<input type="range" id="headYRange" min="-3.2" max="-1.2" step="0.05" value="-1.95" />
<input type="number" id="headYVal" class="sc-val sc-num" min="-3.2" max="-1.2" step="0.05" value="-1.95" />
</div>
<div class="sc-row" title="Arm left-right spread">
<span class="sc-lbl2">Arm X</span>
<input type="range" id="armXRange" min="0" max="0.6" step="0.002" value="0.09" />
<input type="number" id="armXVal" class="sc-val sc-num" min="0" max="0.6" step="0.002" value="0.09" />
</div>
<div class="sc-row" title="Arm vertical position">
<span class="sc-lbl2">Arm Y</span>
<input type="range" id="armYRange" min="-2.6" max="-1.2" step="0.05" value="-1.65" />
<input type="number" id="armYVal" class="sc-val sc-num" min="-2.6" max="-1.2" step="0.05" value="-1.65" />
</div>
<div class="sc-row" title="Leg left-right spread">
<span class="sc-lbl2">Leg X</span>
<input type="range" id="legXRange" min="0" max="0.5" step="0.002" value="0.06" />
<input type="number" id="legXVal" class="sc-val sc-num" min="0" max="0.5" step="0.002" value="0.06" />
</div>
<div class="sc-row" title="Leg vertical position (hip height)">
<span class="sc-lbl2">Leg Y</span>
<input type="range" id="legYRange" min="-1.8" max="-0.6" step="0.05" value="-1.4" />
<input type="number" id="legYVal" class="sc-val sc-num" min="-1.8" max="-0.6" step="0.05" value="-1.4" />
</div>
<div class="sc-row" title="Gap between hand and weapon">
<span class="sc-lbl2">Hand/Weapon</span>
<input type="range" id="handLenRange" min="-0.5" max="2" step="0.05" value="0.3" />
<input type="number" id="handLenVal" class="sc-val sc-num" min="-0.5" max="2" step="0.05" value="0.3" />
</div>
<div class="sc-row" title="Weapon angle (radians) — lower to raise it, 3.14 ≈ pointing down">
<span class="sc-lbl2">Weapon Angle</span>
<input type="range" id="handRotRange" min="-3.14" max="3.14" step="0.05" value="1" />
<input type="number" id="handRotVal" class="sc-val sc-num" min="-3.14" max="3.14" step="0.05" value="1" />
</div>
<button type="button" class="sc-detail-reset" id="detailReset" title="Reset spacing to defaults">↺ Reset Spacing</button>
</div>
</div>
</div>
<div class="stage-controls bottom">
<div class="sc-cluster">
<button class="sc-btn" id="playBtn" title="Play/Pause">⏸</button>
<button class="sc-btn" id="flipBtn" title="Flip horizontally">⇄</button>
<button class="sc-btn" id="weaponBtn" title="Show/hide weapon">⚔</button>
<button class="sc-btn" id="copyBtn" title="Copy the current spacing as a GML function call">⧉</button>
</div>
<div class="sc-cluster zoom-group" id="zoomGroup" title="Zoom (drag to pan)">
<button data-z="0.5">0.5×</button>
<button data-z="1" class="active">1×</button>
<button data-z="2">2×</button>
<button data-z="4">4×</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- STEP 3: GameMaker usage -->
<section class="panel">
<h2><span class="step">3</span> Usage</h2>
<p class="muted small">Setup: import the sheet PNG as a sprite with a <b>single frame</b> → create a script asset and paste the downloaded <code>scr_zuo_motion.gml</code> contents. Then, in your character object's 3 events:</p>
<pre class="code-block"><code>// ① Create — register the character once (weapon is optional)
zuo_motion_create("hero", spr_mysheet, spr_sword);
// "hero" = any name you pick for this character
// spr_mysheet = the imported 3x3 sheet sprite
// spr_sword = weapon image (origin = center). Optional
// ② Step — switch motions whenever you want
if (keyboard_check_pressed(vk_space)) zuo_motion_change("hero", "attack1");
if (hspeed != 0) zuo_motion_change("hero", "walk");
zuo_motion_change("hero", "run", 1.5); // 3rd argument = playback speed for that motion (1.5x)
// ③ Draw — draw the animation
zuo_motion_draw("hero", x, y, 1, image_xscale, image_yscale, image_alpha, c_white);</code></pre>
<ul class="param-list">
<li><code>x, y</code> — where to draw. This point is the character's <b>feet (ground)</b>, so in a platformer just pass the instance's <code>x, y</code> as-is.</li>
<li><code>1</code> (4th arg) — animation <b>speed</b>. <code>1</code>=normal, <code>2</code>=2x, <code>0.5</code>=half. (multiplied by the per-motion speed)</li>
<li><code>image_xscale / image_yscale</code> — <b>size</b>. <code>1</code>=original, <code>2</code>=2x. A <b>negative</b> <code>xscale</code> faces right (left by default).</li>
<li><code>image_alpha</code> — <b>opacity</b> 0–1. <code>1</code>=opaque, <code>0.5</code>=half-transparent.</li>
<li><code>c_white</code> — <b>color tint</b>. <code>c_white</code>=none. Hit-flash example: <code>merge_colour(c_white, c_red, 0.5)</code></li>
<li><b>Weapon</b> — pass a sprite (origin = center) as create's 3rd argument and it's always held in the <b>right hand</b>, swinging <b>behind the arm</b> normally and <b>in front</b> during attacks. Adjust the hand-to-weapon gap with the web's <b>Hand/Weapon</b> slider (= <code>ZUO_WPN_HANDLEN</code>).</li>
<li><b>Spacing</b> — dial in the values in the preview, then click <span class="kbd">⧉</span> to copy a <code>zuo_motion_setgaps(id, …)</code> call to your clipboard. Paste it into the game's Create/Step event to apply that character's spacing. (Global defaults can also be edited via the <code>ZUO_*</code> macros at the top of the script.)</li>
</ul>
</section>
</main>
<footer class="foot">
<span>© 2026 <a href="https://yunjuho.com" target="_blank" rel="noopener">윤주호</a>. All rights reserved.</span>
</footer>
<script src="rig.js"></script>
<script src="template.js"></script>
<script src="preview.js"></script>
<script src="gml-generator.js"></script>
<script src="app.js"></script>
</body>
</html>