简体   繁体   English

如何使用javascript创建此效果?

[英]How do i create this effect using javascript?

The other day i just happened to visit this site :- 前几天我碰巧访问了这个网站: -

http://www.peter-pearson.com/ http://www.peter-pearson.com/

Can anybody tell me how can i create this cool effect. 任何人都可以告诉我如何创造这种很酷的效果。 I know how to horizontally or vertically scroll the page using JQuery's localScroll. 我知道如何使用JQuery的localScroll水平或垂直滚动​​页面。 But if you have seen the webpage, look carefully how beautifully the lines run over the background. 但是,如果您已经看过该网页,请仔细查看线条在背景上的运行情况。 If anybody can tell me how is that effect created i will be very grateful :) 如果有人能告诉我这个效果是如何产生的,我将非常感激:)

PNG with alpha transparency, over a background: 在背景上具有Alpha透明度的PNG:
http://www.peter-pearson.com/images/flow5.png http://www.peter-pearson.com/images/flow5.png
http://www.peter-pearson.com/images/stripey1.jpg http://www.peter-pearson.com/images/stripey1.jpg

[EDIT] [编辑]

It's not really an animation, but a little trick, based on the the transparency. 它不是真正的动画,而是基于透明度的小技巧。
Imagine the following HTML: 想象一下以下HTML:

<div class="div1">
    <div class="div2">
    </div>
</div>

div1 has the stripe-pattern background image, positioned as fixed, so it will move when you scroll. div1具有条纹图案背景图像,定位为固定,因此滚动时它将移动。
div2 has the partially-transparent background image, not fixed. div2具有部分透明的背景图像,而不是固定的。

So when you scroll the page, the pattern image will appear at some places, because the other background image is transparent, giving you a sort of animation effect. 因此,当您滚动页面时,图案图像将出现在某些位置,因为其他背景图像是透明的,从而为您提供一种动画效果。

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

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