I am constantly changing the inline styles with a text editor and so I am wondering is there a way to export the hype animation basically I am changing this:
It clears the styles of the current element and replaces them with an array of your own styles:
<script>
// runs after the scene has been loaded. This code goes in the 'head' of your Hype document:
function myCallback(hypeDocument, element, event) {
function clearAndApplyStyles(elementId, styles) {
var element = document.getElementById(elementId);
if (!element) {
console.error("Element with ID '" + elementId + "' not found.");
return;
}
// Clear all inline styles
element.removeAttribute("style");
// Apply new styles
for (var key in styles) {
if (styles.hasOwnProperty(key)) {
element.style[key] = styles[key];
}
}
}
var styles = {
margin: "auto",
position: "absolute",
top: "0",
width: "100%",
overflow: "hidden",
};
// Comment out this first line after testing:
clearAndApplyStyles("index_hype_container", styles);
clearAndApplyStyles("myAnimation_hype_container", styles);
}
// Add Hype event listener
if (!window.HYPE_eventListeners) {
window.HYPE_eventListeners = [];
}
window.HYPE_eventListeners.push({ type: "HypeDocumentLoad", callback: myCallback });
</script>