I have a svg
image embedded in this object:
<object id="firstrule" type="image/svg+xml" data="/assets/rules/pertinance.svg"></object>
I am looking to create an animation that will make the svg image visible on scroll. I have successfully set up the scroll callback function, but now I need help implementing the animation.
The desired animation effect is to start with the svg image at 0% width, and then have it expand to its full size of 100% when the callback is triggered. The animation should take 3 seconds, gradually increasing the size from 0% to 100% over this duration.
To achieve this, I attempted the following steps: 1) Initially setting the width attribute of the object "firstrule" to 0%
<object id="firstrule" type="image/svg+xml" data="/assets/rules/pertinance.svg" width="0%"></object>
2) Trying to animate the width using jQuery
$('#firstrule').animate({'width':'100%'},3000);
However, this approach did not work as expected, yielding the error:
TypeError: Cannot set property 'cur' of undefined
Do you have an alternative solution (perhaps involving CSS3), or ideas on how to troubleshoot this issue? I am seeking a straightforward resolution without the need for excessive code or plugins. Any insights on overcoming this challenge would be greatly appreciated.