How to activate a Canvas animation only when scrolled into view.
Hi All,
I've searched this forum for the answer to no avail. I did find the same issue here and posted my question there but no response yet.
My animation (exported to Canvas from Animate) is 2 seconds long but positioned below the fold so visitors won't see it move because it's done before they scroll to it. Here's my page in progress with the 'Skills Graph" FLA located in the first section below the video header:
-I just want the orange color to fill the bars when user scrolls the FLA into view.
I've followed the recommendations at the forum thread above. Here is the JSFiddle demo linked from that thread: Edit fiddle - JSFiddle
I've gotten the Waypoint method to work at the bottom of my page, using the bar graph in the demo. (The bar graph animates only when the user scrolls all the way to the bottom of my page.) But how do I now use that same method to get my Skills Graph animation to start only when in view?
For example, when you look at the source for my page ( ) you'll see the Waypoint style:
</style>
<script type="text/javascript">
$(window).load(function(){
var $elem = $('.someClass .anotherClass'); //<==Those are variables that are used as classes for the bar graph in the JSFiddle example
var in_view = new Waypoint.Inview({
element: $elem[0],
enter: function() {
$elem.addClass('start');
},
exit: function() { // optionally
$elem.removeClass('start');
}
});
});
</script>
---------------------------------------------------------------------------
..and my div with the animation container:
<div class="someClass" id="animation_container" style="float: left; width: 300px;" >
<canvas id="canvas" width="300" height="100" style="position: absolute; display: block; background-color:rgba(255, 255, 255, 1.00);"></canvas>
<div class="anotherClass" id="dom_overlay_container" style="pointer-events:none; overflow:hidden; width:300px; height:100px; position: absolute; left: 0px; top: 0px; display: block;">
</div>
</div>
I added the class values from above, in a futile attempt to make this work.
Any help is greatly appreciated!
