简体   繁体   English

滚动上的SVG动画?

[英]SVG animation on scroll?

I have a small svg: 我有一个小svg:

 <svg xmlns="http://www.w3.org/2000/svg" width="164.969" height="195"> <path d="M164.979 28.97a3.675 3.675 0 0 1-6.19 2.66 90.127 90.127 0 1 0-.99 132.64 3.685 3.685 0 0 1 4.95 5.46 97.5 97.5 0 1 1 1.07-143.48 3.656 3.656 0 0 1 1.16 2.72z" fill="url(#linear-gradient)" fill-rule="evenodd"></path> <linearGradient id="linear-gradient"> <stop offset="0%" stop-color="#e87975"></stop> <stop offset="100%" stop-color="#f3c7a1"></stop> </linearGradient> </svg> 

I wonder if it possible to somehow fill the white background with linear gradient on scroll from top start to bottom end? 我想知道是否可能以某种方式从上到下滚动滚动渐变填充白色背景? Unfortunately I found only drawing examples on intentet and my small expericence in jQuery doesn't give me a chance to do it by myself. 不幸的是,我发现仅在Intentet上绘制示例,而我在jQuery中的小经验并不能给我自己一个机会。 Thank you! 谢谢!

For the Background stuff look at this: How to create gradient color in svg background 对于Background,请看以下内容: 如何在SVG背景中创建渐变颜色

For scrolling, this could be helpfull: http://cbron.github.io/blog/2013/12/30/draw-svg-path-on-scroll-tutorial/ 对于滚动,这可能会有所帮助: http : //cbron.github.io/blog/2013/12/30/draw-svg-path-on-scroll-tutorial/

Anyway: Instead of jQuery you should try Snap.svg for manipulating your SVG. 无论如何:您应该尝试使用Snap.svg而不是jQuery来操纵SVG。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM