脚本速查表#
目录#
音频#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以 https:// 开头,并且必须以 .mp3 等音频扩展名结尾。
获取属性值#
feature.get('url')
// 返回:"https://..."
设置属性值#
feature.set({'url': "https://www.myurl.com/file.mp3"})
默认值#
""
sprite#
布尔值
获取属性值#
feature.get('sprite')
// 返回:false
设置属性值#
feature.set({'sprite': true})
默认值#
false
streaming#
布尔值
获取属性值#
feature.get('streaming')
// 返回:false
设置属性值#
feature.set({'streaming': true})
默认值#
false
autoplay#
布尔值
获取属性值#
feature.get('autoplay')
// 返回:false
设置属性值#
feature.set({'autoplay': true})
默认值#
false
loop#
布尔值
获取属性值#
feature.get('loop')
// 返回:false
设置属性值#
feature.set({'loop': true})
默认值#
false
rolloffFactor#
浮点数;值范围从0到5
获取属性值#
feature.get('rolloffFactor')
// 返回:1.6
设置属性值#
feature.set({'rolloffFactor': 1.6})
默认值#
1.6
volume#
浮点数;值范围从0到1
获取属性值#
feature.get('volume')
// 返回:0.5
设置属性值#
feature.set({'volume': 0.5})
默认值#
0.5
type#
字符串
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"audio"
脚本方法#
脚本方法 {.tabset}#
play()#
feature.play()
播放音频
pause()#
feature.pause()
暂停音频
按钮#
脚本属性#
脚本属性 {.tabset}#
color#
字符串;选项为’white’、’red’、’green’和’blue’。
获取属性值#
feature.get('color')
// 返回:"red"
设置属性值#
feature.set({'color': "blue"})
默认值#
"red"
soundId#
整数;可以是0到14范围内的整数。
'-1' - 无
'0' - 叮咚
'1' - 乒乓
'2' - pshlick - 听起来像液压触发器
'3' - breet - 听起来像PC试图连接互联网
'4' - claclack - 听起来像有人在键盘上连续按键
'5' - tpow Cling - 听起来像球击中球拍,然后击中金属杆
'6' - traarz - 听起来像打印机
'7' - wuwuwuwu - 听起来像UFO
'8' - flickfli - 听起来像有人翻阅纸张
'9' - pshing dong - 听起来像钹和叮咚
'10' - bzing - 听起来像一个快速的嗡嗡声(真的)
'11' - tadaw - 听起来像小丑的声音
'12' - shplow - 听起来像PVC管被击中
'13' - tshlshlsh - 听起来像一个笔记计数器
'14' - miaaaaaa - 听起来像有人骚扰一只猫
'15' - miaoowww - 听起来像一只饥饿的猫
获取属性值#
feature.get('soundId')
// 返回:"0"
设置属性值#
feature.set({'soundId': "-1"})
//请记住soundId必须是字符串类型
默认值#
"0"
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"button"
如何使用#
通过脚本字段,您可以监听点击事件:
feature.on('click', e => {
// 在此处执行点击时的操作
})
您还可以通过以下方式知道谁点击了按钮:
feature.on('click', e => {
console.log(e.player)
})
图片#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以 https:// 开头,并且必须以 .jpg/.gif/.png 等扩展名结尾。
获取属性值#
feature.get('url')
//
return: "https://..."
设置属性值#
feature.set({'url': "https://www.myurl.com/file.png"})
默认值#
""
link#
字符串;链接必须以https://开头。
获取属性值#
feature.get('link')
// 返回:"https://..."
设置属性值#
feature.set({'link': "https://www.myurl.com/"})
默认值#
""
blendMode#
字符串
获取属性值#
feature.get('blendMode')
// 返回:"Combine"
设置属性值#
feature.set({'blendMode': 'Combine'})
默认值#
"Multiply"
updateDaily#
布尔值
获取属性值#
feature.get('updateDaily')
// 返回:false
设置属性值#
feature.set({'updateDaily': true})
默认值#
false
transparent#
布尔值
获取属性值#
feature.get('transparent')
// 返回:false
设置属性值#
feature.set({'transparent': true})
默认值#
false
stretched#
布尔值
获取属性值#
feature.get('stretched')
// 返回:false
设置属性值#
feature.set({'stretched': true})
默认值#
false
uScale#
整数
获取属性值#
feature.get('uScale')
// 返回:1
设置属性值#
feature.set({'uScale': 1})
默认值#
1
vScale#
整数
获取属性值#
feature.get('vScale')
// 返回:1
设置属性值#
feature.set({'vScale': 1})
默认值#
1
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"image"
Megavox#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以https://开头,并且必须以.vox等vox模型扩展名结尾。
必须链接到一个126x126x126的vox模型。
获取属性值#
feature.get('url')
// 返回:"https://..."
设置属性值#
feature.set({'url': "https://www.myurl.com/file.vox"})
默认值#
""
link#
字符串;链接必须以https://开头。
获取属性值#
feature.get('link')
// 返回:"https://..."
设置属性值#
feature.set({'link': "https://www.myurl.com/"})
默认值#
""
collidable#
布尔值
获取属性值#
feature.get('collidable')
// 返回:false
设置属性值#
feature.set({'collidable': true})
默认值#
false
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"megavox"
粒子#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以https://开头,并且必须以.jpg/.gif/.png等扩展名结尾。
如果您设置了URL,则自定义颜色color1和color2将被忽略。 {.is-info}
获取属性值#
feature.get('url')
// 返回:"https://..."
设置属性值#
feature.set({'url': "https://www.myurl.com/file.png"})
默认值#
""
emitRate#
双精度;必须是0到100之间的数字。
获取属性值#
feature.get('emitRate')
// 返回:50.0
设置属性值#
feature.set({'emitRate': 52})
默认值#
50
minSize#
双精度;必须是0到1之间的数字。
获取属性值#
feature.get('minSize')
// 返回:0.5
设置属性值#
feature.set({'minSize': 0.5})
默认值#
0.5
maxSize#
双精度;必须是0到1之间的数字。
获取属性值#
feature.get('maxSize')
// 返回:0.5
设置属性值#
feature.set({'maxSize': 0.5})
默认值#
0.5
color1#
字符串 - 十六进制;
获取属性值#
feature.get('color1')
// 返回:"#4cb844"
设置属性值#
feature.set({'color1': "#4cb844"})
默认值#
#000000
color2#
字符串 - 十六进制;
获取属性值#
feature.get('color2')
// 返回:"#4cb888"
设置属性值#
feature.set({'color2': "#4cb844"})
默认值#
"#000000"
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"particles"
多边形文本#
脚本属性#
脚本属性 {.tabset}#
text#
字符串;
获取属性值#
feature.get('text')
// 返回:"My new text"
设置属性值#
feature.set({'text': "My new text"})
默认值#
""
edges#
布尔值
获取属性值#
feature.get('edges')
// 返回:false
设置属性值#
feature.set({'edges': true})
默认值#
false
type#
字符串;
获取属性值#
feature
.get('type')
/* 或 */
feature.type
// 返回:"polytext"
文本输入#
脚本属性#
脚本属性 {.tabset}#
text#
字符串;
获取属性值#
feature.get('text')
// 返回:"my text"
设置属性值#
feature.set({'text': "my text"})
默认值#
""
placeholder#
字符串;
获取属性值#
feature.get('placeholder')
// 返回:"my text"
设置属性值#
feature.set({'placeholder': "my text"})
默认值#
"placeholder"
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"text-input"
YouTube / Twitch#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以https://开头,并且必须是youtube, twitch, soundcloud, spotify之一。
获取属性值#
feature.get('url')
// 返回:"https://..."
设置属性值#
feature.set({'url': "https://www.youtube.com/?v=..."})
默认值#
""
previewUrl#
字符串;链接必须以https://开头,并且必须是.png,.gif,jpg之一。
获取属性值#
feature.get('previewUrl')
// 返回:"https://..."
设置属性值#
feature.set({'previewUrl': "https://..."})
默认值#
""
screenRatio#
字符串;链接必须以https://开头,并且必须是.png,.gif,jpg之一。
获取属性值#
feature.get('screenRatio')
// 返回:"43"
设置属性值#
feature.set({'screenRatio': "169"})
默认值#
"169"
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"youtube"
脚本方法#
脚本方法 {.tabset}#
play()#
feature.play()
播放视频
暂停#
feature.pause()
暂停视频
音乐盒#
脚本属性#
脚本属性 {.tabset}#
rollOffFactor#
双精度;取值范围为0到5
获取属性值#
feature.get('rolloffFactor')
// 返回:1.6
设置属性值#
feature.set({'rolloffFactor': 1.6})
默认值#
1
NFT 图像#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以https://开头。
获取属性值#
feature.get('url')
// 返回:"https://..."
设置属性值#
feature.set({'url': "https://www.opensea.io/"})
默认值#
""
stretch#
布尔值;
获取属性值#
feature.get('stretch')
// 返回:"https://..."
设置属性值#
feature.set({'stretch': true})
默认值#
false
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"nft-image"
富文本#
脚本属性#
脚本属性 {.tabset}#
text#
字符串;
获取属性值#
feature.get('text')
// 返回:"https://..."
设置属性值#
feature.set({'text': "my paragraph"})
默认值#
""
blendMode#
字符串
获取属性值#
feature.get('blendMode')
// 返回:"Combine"
设置属性值#
feature.set({'blendMode': 'Combine'})
默认值#
"Multiply"
inverted#
布尔值;
获取属性值#
feature.get('inverted')
// 返回:false
设置属性值#
feature.set({'inverted': true})
默认值#
false
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"richtext"
招牌#
脚本属性#
脚本属性 {.tabset}#
text#
字符串;
获取属性值#
feature.get('text')
// 返回:"my line of text"
设置属性值#
feature.set({'text': "my line of text"})
默认值#
""
link#
字符串;
获取属性值#
feature.get('link')
// 返回:"https://..."
设置属性值#
feature.set({'link': "https://..."})
默认值#
""
fontSize#
整数;
获取属性值#
feature.get('fontSize')
// 返回:25
设置属性值#
feature.set({'fontSize': 25})
默认值#
25
color#
字符串-十六进制;
获取属性值#
feature.get('color')
// 返回:"#00000"
设置属性值#
feature.set({'color': "#fcba03"})
默认值#
"#00000"
background#
字符串-十六进制;
获取属性值#
feature.get('background')
// 返回:"#00000"
设置属性值#
feature.set({'background': "#fcba03"})
默认值#
"#fffff"
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
//
return: "sign"
视频#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以https://开头,并且必须以.mp4等视频扩展名结尾。
获取属性值#
feature.get('url')
// 返回:"https://..."
设置属性值#
feature.set({'url': "https://www.myurl.com/file.mp4"})
默认值#
""
loop#
布尔值
获取属性值#
feature.get('loop')
// 返回:false
设置属性值#
feature.set({'loop': true})
默认值#
false
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"video"
.VOX#
脚本属性#
脚本属性 {.tabset}#
url#
字符串;链接必须以https://开头,并且必须以.vox等vox模型扩展名结尾。
必须链接到一个126x126x126的vox模型。
获取属性值#
feature.get('url')
// 返回:"https://..."
设置属性值#
feature.set({'url': "https://www.myurl.com/file.vox"})
默认值#
""
link#
字符串;链接必须以https://开头。
获取属性值#
feature.get('link')
// 返回:"https://..."
设置属性值#
feature.set({'link': "https://www.myurl.com/"})
默认值#
""
collidable#
布尔值
获取属性值#
feature.get('collidable')
// 返回:false
设置属性值#
feature.set({'collidable': true})
默认值#
false
type#
字符串;
获取属性值#
feature.get('type')
/* 或 */
feature.type
// 返回:"vox"