html - JavaScript, html5: how to dynamically create a Vignette effect? - Stack Overflow

So what I need is simple: user presses something, user sees Vignette effect on new div on top of all pa

So what I need is simple: user presses something, user sees Vignette effect on new div on top of all page (with page size) alike

Is it possible with some html5 canvas art? And how to do such thing?

So what I need is simple: user presses something, user sees Vignette effect on new div on top of all page (with page size) alike

Is it possible with some html5 canvas art? And how to do such thing?

Share Improve this question asked Jun 12, 2011 at 17:12 RellaRella 67.1k112 gold badges374 silver badges642 bronze badges 1
  • If you're really talking about HTML5-capable browsers, you could probably do this without needing a canvas. You'd just need a rounded-corner box (or two) with some widely-blurred box shadow(s). – Pointy Commented Jun 12, 2011 at 17:16
Add a ment  | 

1 Answer 1

Reset to default 6

Well, this is exactly how Chrome's settings page is doing it: http://jsfiddle/JRGHM/

.overlay {
  -webkit-box-align: center;
  -webkit-box-pack: center;
  -webkit-transition: 0.25s opacity;
  background: -webkit-radial-gradient(rgba(127, 127, 127, 0.5),
                                      rgba(127, 127, 127, 0.5) 35%,
                                      rgba(0, 0, 0, 0.7));
  bottom: 0;
  display: -webkit-box;
  left: 0;
  padding: 20px;
  padding-bottom: 130px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 10;
}

As you can see, the important part is the gradient.

You can make that code work in all browsers that support CSS3 gradients by adding the appropriate gradient syntax: http://caniuse./#feat=css-gradients

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745219854a4617198.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信