使用HTML5 Canvas进行静态噪音动画

使用HTML5 Canvas进行静态噪音动画,第1张

概述所以我刚刚在Awwwards探索了一大堆新的网站.其中一个特别引起我注意的是this.我刚刚做了一些基本的中间CSS内容.我想知道这些家伙是如何得到他们的字体的噪音/干扰?我完全无能为力.试过检查代码,无法理解.我知道我不能很快建立整个事物,但我喜欢嘈杂背景的想法.我该怎么办?任何指针将不胜感激:)最佳答案这是Lucas Bebber的Glitch SVG效

所以我刚刚在Awwwards探索了一大堆新的网站.其中一个特别引起我注意的是this.我刚刚做了一些基本的中间CSS内容.我想知道这些家伙是如何得到他们的字体的噪音/干扰?我完全无能为力.试过检查代码,无法理解.

我知道我不能很快建立整个事物,但我喜欢嘈杂背景的想法.

我该怎么办?任何指针将不胜感激:)

最佳答案这是Lucas Bebber的Glitch SVG效果.

这是original and working demo

这是代码片段

body {  background: black;  Font-family: 'Varela',sans-serif;}.glitch {  color: white;  Font-size: 100px;  position: relative;  wIDth: 400px;  margin: 0 auto;}@keyframes noise-anim {  $steps: 20;  @for $i from 0 through $steps {    # {      percentage($i*(1/$steps))    }    {      clip: rect(random(100)+px,9999px,random(100)+px,0);    }  }}.glitch:after {  content: attr(data-text);  position: absolute;  left: 2px;  text-shadow: -1px 0 red;  top: 0;  color: white;  background: black;  overflow: hIDden;  clip: rect(0,900px,0);  animation: noise-anim 2s infinite linear alternate-reverse;}@keyframes noise-anim-2 {  $steps: 20;  @for $i from 0 through $steps {    # {      percentage($i*(1/$steps))    }    {      clip: rect(random(100)+px,0);    }  }}.glitch:before {  content: attr(data-text);  position: absolute;  left: -2px;  text-shadow: 1px 0 blue;  top: 0;  color: white;  background: black;  overflow: hIDden;  clip: rect(0,0);  animation: noise-anim-2 3s infinite linear alternate-reverse;}
          总结       

以上是内存溢出为你收集整理的使用HTML5 Canvas进行静态/噪音动画全部内容,希望文章能够帮你解决使用HTML5 Canvas进行静态/噪音动画所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1124803.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)