Thanks any work around will be great! I was just checking out https://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the- current-viewport
for the trigger. I've also used Wow.js in the past. Communicating with the decompressed OAM file is probably the trickiest part.
We'll look at https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame
and let you know how far we get.
On this project we ended up with a quick fix, loading the canvas file on view rather than stopping and starting it.
Embed...
<div class="embed-responsive embed-responsive-16by9 os-animation animated fadeInUp"><object class="embed-responsive-item" id="EdgeID" width="820" height="390" type="text/html" data-dw-widget="Edge">
</object></div>
JS...
<script>
function isInViewport(elem) {
var bounding = elem.getBoundingClientRect();
return (
bounding.top >= 0 &&
bounding.left >= 0 &&
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
bounding.right <= (window.innerWidth || document.documentElement.clientWidth)
);
}
var isEdgeId = false;
- window.addEventListener("scroll", function(event) {
var edgeId = document.getElementById("EdgeID");
if (!isEdgeId && isInViewport(edgeId)) {
edgeId.data = "/animation_assets/MI-Ani2/Assets/MI-Ani2.html";
isEdgeId = true;
}
});
</script>
Notes: Animation appears only when fully in view (We may try loading placeholder).
Still looking for any additional options. It would be great to have a solution built into Dreamweaver, especially being able to advance the timeline on scroll. Thanks to our programmer Paul for this one, and for everyone's support!
-ian