From jugglingpatterns
Content deleted Content added
No edit summary Tag: Reverted |
No edit summary |
||
| (37 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
function loadModule(src) { |
|||
/* Any JavaScript here will be loaded for all users on every page load. */ |
|||
const s = document.createElement('script'); |
|||
| ⚫ | |||
s.src = src; |
|||
document.head.appendChild(s); |
|||
} |
|||
// deine beiden Dateien laden |
|||
<div class="horizontal-split"> |
|||
loadModule('/js/animation.js'); |
|||
<div id="siteswapanimation" data-siteswapnr="your_siteswap_value_here"></div> |
|||
</div> |
|||
| ⚫ | |||
import Siteswap from '/js/siteswap.mjs'; |
|||
import AnimationWidget from '/js/animation-widget-standalone.mjs'; |
|||
// use by using Template:AnimateSiteswap which provides the matching html |
|||
// Get the siteswapnr from the data attribute of the element |
|||
console.log("importing animations"); |
|||
const animationPlace = document.getElementById('siteswapanimation'); |
|||
const siteswapnr = animationPlace.dataset.siteswapnr; |
|||
// Use siteswapnr to create the Siteswap object |
|||
const sw = new Siteswap(siteswapnr); |
|||
// Your other logic for creating jif and AnimationWidget |
|||
console.log(JSON.stringify(sw)); |
|||
const myjson = { jugglers: 2, limbs: "ABCD" }; |
|||
myjson.props = Array.apply(null, Array(sw.nProps)).map(function () { return {}; }); |
|||
Latest revision as of 19:20, 8 September 2025
function loadModule(src) {
const s = document.createElement('script');
s.type = 'module';
s.src = src;
document.head.appendChild(s);
}
// deine beiden Dateien laden
loadModule('/js/animation.js');
// use by using Template:AnimateSiteswap which provides the matching html
console.log("importing animations");