Files
P42_UI/app/assets/html/help/KFconsoleHelp.html
T
2026-06-05 09:09:53 +00:00

58 lines
3.0 KiB
HTML

<style>
.kf-editor .inner-console .results .api-summary{ border: 1px solid white;margin: .5em;width: 90%; border-radius: 7px;}
.kf-editor .inner-console .results .api-summary h1{
font-size: 1.5em;
margin: 0;
padding: 0 .5em 0 .5em;
background-color: #473;
color: white;
width: auto;
}
.kf-editor .inner-console .results .title{
background: #DDD;
color: black;
}
.kf-editor .inner-console .results button[data-trigger="onExample"]{ margin-left: 2em; }
</style>
<div class="title">Javascript Keyframe console</div>
Use any combination of Javascript and API calls to update your keyframe scene.<br>
Special commands:<br>
"&#92;help" for help & API<br>
"&#92;clear" to clear results<br>
<div class="api-summary">
<h1>API:</h1>
<ul>
<li>Log here: <b>log()</b> - any number of arguments of any type</li>
<li>Create an agent: <b>createAgent(type, properties)</b> - Promise returning the AID <button eicbutton info xxsmall data-trigger="onSnippet" data-snippet="createAgent">Snippet</button></li>
<li>Remove an agent: <b>removeAgent(aid)</b> - Promise<button eicbutton info xxsmall data-trigger="onSnippet" data-snippet="removeAgent">Snippet</button></li>
<li>Update an agent: <b>updateAgent(aid, properties)</b> - Promise <button eicbutton info xxsmall data-trigger="onSnippet" data-snippet="updateAgent">Snippet</button></li>
<li>Toggle selection of an agent: <b>selectAgent(aid)</b> - Promise<button eicbutton info xxsmall data-trigger="onSnippet" data-snippet="selectAgent">Snippet</button></li>
<li>List agent types: <b>listAgentTypes()</b> - Promise<button eicbutton info xxsmall data-trigger="onSnippet" data-snippet="listAgentTypes">Snippet</button></li>
<li>List agents on scene: <b>listAgentsOnScene()</b> - Promise<button eicbutton info xxsmall data-trigger="onSnippet" data-snippet="listAgentsOnScene">Snippet</button></li>
</ul>
</div>
<div class="snippet" data-snippet="createAgent" style="display:none">
const agtIds = []
for(let i=0; i<360; i+=22.5){
agtIds.push(
await createAgent(1, { position: { x: 10*Math.sin(i*Math.PI/180), y: 10*Math.cos(i*Math.PI/180), z: 0 } } )
)
}
log(agtIds)
</div>
<div class="snippet" data-snippet="removeAgent" style="display:none;">
await removeAgent('00000000-aaaa-bbbb-cccc-dddddddddddd')
</div>
<div class="snippet" data-snippet="updateAgent" style="display:none;">
await updateAgent('00000000-aaaa-bbbb-cccc-dddddddddddd', { position: { x: 5, y: 10, z: 0 } })
</div>
<div class="snippet" data-snippet="selectAgent" style="display:none;">
await selectAgent('00000000-aaaa-bbbb-cccc-dddddddddddd')
</div>
<div class="snippet" data-snippet="listAgentTypes" style="display:none;">
for(const agt of await listAgentTypes()) { log(agt.atp_id+':'+agt.atp_name)
</div>
<div class="snippet" data-snippet="listAgentsOnScene" style="display:none;">
const agts = await listAgentsOnScene()
for(const aid in agts){ log(`${aid}:${JSON.stringify(agts[aid])}`,'----------') }
</div>