34 lines
No EOL
2.3 KiB
HTML
34 lines
No EOL
2.3 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Anim.cell_y — Ludic</title>
|
||
<meta name="description" content="The source y (pixels) of a frame on a grid spritesheet.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="ns-anim.html">Anim</a> <span>›</span> <span class="here">Anim.cell_y</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Anim.cell_y</h1>
|
||
</div>
|
||
<code class="sig">Anim.cell_y(frame, cols, cell_h) -> int</code>
|
||
<div class="desc"><p>Turns a frame index into the top pixel of its cell on a spritesheet laid out as a grid of <code>cols</code> columns: <code>(frame / cols) * cell_h</code>. Pair with <a href="anim-cell_x"><code>Anim.cell_x</code></a> for the full source rectangle of the frame.</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-frame"><code class="pname">frame</code><span class="pdesc">the frame index (e.g. from <a href="anim-frame"><code>Anim.frame</code></a>)</span></div><div class="param" id="param-cols"><code class="pname">cols</code><span class="pdesc">columns in the sheet</span></div><div class="param" id="param-cell_h"><code class="pname">cell_h</code><span class="pdesc">cell height in pixels</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Demo {
|
||
handler Run phase Update {
|
||
let f = Anim.frame(fixed(1), 12, 8)
|
||
let sy = Anim.cell_y(f, 4, 16)
|
||
print(sy)
|
||
}
|
||
}</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |