Files

27 lines
656 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# klon_siluet.js — applyAlpha() (satır 765)
[← klon_siluet.js](index.md) · [← Master](../../wiki.md)
```javascript
function applyAlpha(morph, alpha)
{
if (!morph || alpha >= 0.999) return morph;
try
{
var nbt = mappet.toNBT(morph);
var a = Math.round(alpha * 255);
if (a < 0) a = 0; else if (a > 255) a = 255;
try { nbt.setInt("Color", (a << 24) | 0xFFFFFF); } catch (e1) {}
try { nbt.setFloat("Opacity", alpha); } catch (e2) {}
var out = mappet.createMorph(nbt);
if (out) return out;
}
catch (e) {}
return morph;
}
```