Spine:修订间差异
来自卡厄思梦境WIKI
创建页面,内容为“<includeonly><!-- 开始 Widget 代码 --> <div class="spine-widget-wrapper"> <link rel="stylesheet" href="/spine/spine-player.css"> <div id="spine-player-<!--{$id|default:random}-->" class="spine-player-container" style="width:<!--{$width|escape:'html'|default:'640'}-->px; height:<!--{$height|escape:'html'|default:'480'}-->px;"> </div> <script src="/spine/spine-player.js"></script> <script> (function() { var playerId = 'spine…” |
小无编辑摘要 |
||
| (未显示同一用户的3个中间版本) | |||
| 第1行: | 第1行: | ||
<includeonly | <includeonly> | ||
<div | <div id="spine-widget-<!--{$id|default:'player'}-->" style="width:<!--{$width|default:'640'}-->px; height:<!--{$height|default:'480'}-->px; background:<!--{$bg|default:'#ffffff'}-->;"></div> | ||
<link rel="stylesheet" href="https://unpkg.com/@esotericsoftware/spine-player@4.1.*/dist/spine-player.css"> | |||
<script> | |||
(function() { | |||
var widgetId = "spine-widget-<!--{$id|default:'player'}-->"; | |||
var config = { | |||
jsonUrl: "<!--{$json}-->", | |||
atlasUrl: "<!--{$atlas}-->", | |||
var | animation: "<!--{$animation|default:''}-->", | ||
var | skin: "<!--{$skin|default:'default'}-->", | ||
backgroundColor: "<!--{$bg|default:'#ffffff'}-->", | |||
alpha: true, | |||
viewport: { | |||
padLeft: "0%", | |||
padRight: "0%", | |||
padTop: "0%", | |||
padBottom: "0%" | |||
}, | |||
showControls: true, | |||
scale: parseFloat("<!--{$scale|default:'1'}-->") | |||
}; | |||
if (! | function initSpinePlayer() { | ||
if (typeof spine !== 'undefined' && spine.SpinePlayer) { | |||
new spine.SpinePlayer(widgetId, config); | |||
} else { | |||
console.error('Spine Player library not loaded'); | |||
} | |||
} | } | ||
// | // 检查是否已加载 Spine 库 | ||
if ( | if (typeof spine !== 'undefined') { | ||
initSpinePlayer(); | |||
} else { | } else { | ||
// 动态加载 Spine Player 脚本 | |||
var script = document.createElement('script'); | |||
script.src = 'https://esotericsoftware.com/files/spine-player/3.8/spine-player.js'; | |||
script.onload = function() { | |||
initSpinePlayer(); | |||
}; | |||
script.onerror = function() { | |||
console.error('Failed to load Spine Player library'); | |||
}; | |||
document.head.appendChild(script); | |||
} | } | ||
})(); | |||
</script> | |||
</includeonly> | </includeonly> | ||