opacity

CALayer opacity animation

一笑奈何 提交于 2019-12-03 15:14:45
问题 I want to create a CALayer animation that gives sort of a 'flashy' effect. For that I'm trying to animate the 'opacity' property, but my problem is that I have no idea where to start and how to do it. Here is a graphical explanation of the animation: opacity | ___ 1 | | | | | | * repeatCount 0 |___| |_ . . . -------------------------> time |______| duration The opacity starts at 0, then animates to 1, then to 0 again (this 0-to-1-to-0 animation takes a number of seconds equal to duration).

Python PIL 0.5 opacity, transparency, alpha

时间秒杀一切 提交于 2019-12-03 15:04:53
Is there any way to make an image half transparent? the pseudo code is something like this: from PIL import Image image = Image.open('image.png') image = alpha(image, 0.5) I googled it for a couple of hours but I can't find anything useful. I realize this question is really old, but with the current version of Pillow (v4.2.1), there is a function called putalpha . It seems to work fine for me. I don't know if will work for every situation where you need to change the alpha, but it does work. It sets the alpha value for every pixel in the image. It seems, though that you can use a mask: http:/

jquery fade out div with page scroll

梦想与她 提交于 2019-12-03 13:27:31
问题 I am trying to fade a div out as the page scrolls down (with the page scroll - not just a fadeOut effect). I'm adjusting the opacity of the div as the page scrolls down using this piece of code here: $(window).scroll(function() { var scroll = $(window).scrollTop(); $('.logo_container').css({'opacity':( 100-scroll )/100}); }); My issue here is that for me it fades out too fast, I'd like a much more subtle fade as the user scrolls. Can anyone think of a better logic to make a slower, more

Transparency of a filled stroke in HTML5

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 13:01:47
问题 I'm working on a doodling app in HTML5 and I would like to do a sort of bucket feature. The idea is to draw a path and it will be closed and filled with the selected colour (colour of the stroke). It works quite well with solid colours, but if I want to have a transparent stroke and fill, I run into this problem: http://imgur.com/0N3MW What happens is the fill is done until the middle of the stroke (the actual sampling point of the path) so there's a line of half the size of the stroke inside

How to dim an image keeping transparency untouched with CSS or JS?

主宰稳场 提交于 2019-12-03 12:33:32
Normal approach to dimming an image suggested everywhere is to change it's opacity attribute and display something dark under it. However, my image has transparency and is on white background. So I want to keep the background under transparent parts of image white, only making darker the pixels that have color. Is this possible to do in CSS (preferably) or JS? EDIT: Sample images http://imgur.com/a/Tat9f Example image: There is a relatively new CSS property filter which might achieve what you are after. The brightness option seems to be what you are after. EDIT - Added interim support for FF

Creating a linear transparent gradient to a div

孤街浪徒 提交于 2019-12-03 12:21:42
I'd like to create a linear transparent gradient to a div. Is there any way to do that with jquery? Or should I use some other library like raphaeljs? I'd like to achieve an effect like the following: Why not keep it light and browser compatible. div { backgroud-image: url('images/gradient.png'); background-repeat: repeat-x; background-position: top right; } Christian Tellnes You can do it with CSS3: E.g. div { opacity: 0.5; background: #999; /* for non-css3 browsers */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000'); /* for IE */ background:

Jquery - dim entire page and fade up one div element

自古美人都是妖i 提交于 2019-12-03 12:09:41
Im trying to do the following: - a Link is clicked triggering a function that will .show a DIV (#page-cover) dimming down my entire background. This div has a z-index of 999 - Then I want another div (#red) to appear upon the dimmed background / fadeup/show with a higher z-index My CSS: #page-cover { display: none; position: fixed; width: 100%; height: 100%; background-color: #000; z-index: 999; top: 0; left: 0; } #red { background-color: red; width: 100px; height: 100px; } HTML //Triggering link <a href="#" onclick="dimBackground("Element1")">Element 1</a> //Div to appear upon dimmed DIV <div

Multiple CSS filters in IE

﹥>﹥吖頭↗ 提交于 2019-12-03 11:54:47
I'm just wondering that it is possible to apply two different filters in IE using CSS. So, I need to use a transparent PNG and also some opacity to a div . Is it possible to use both of them? My transparent-maker line looks like this: li.item .item-texture { background: none transparent scroll repeat 0% 0% !important; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/ie/articles/item-content-hov.png', sizingMethod='scale') !important; } I've tried to add one more line ( filter: alpha(opacity=50); ) and separate filters with comma ( .. 'scale') !important, alpha(opacity=50

On scroll change opacity of header?

丶灬走出姿态 提交于 2019-12-03 09:48:54
Im so new to JQuery and im sure the answer is super basic. But if someone can point me in the right direction that would be great. I just want the opacity of my header to change from 0 to 1 as the user scrolls past 400 pixels. HELP? www.HULU.com has a perfect example. <code> <script> $(document).ready(function() { $(window).scroll(function() { if ($(this).scrollTop() > 400) { $('.header').css("background", "#000"); } else { $('.header').css("background", "transparent"); } }); }); </script> </code> Try this one: Example: http://jsfiddle.net/SEH5M/ HTML: <div class="header"> <div id="background"

Changing Bootstrap's navbar opacity without affecting the buttons

余生颓废 提交于 2019-12-03 08:27:59
I only want my navbar buttons to be visible, while the actual bar that spans across the entire page has full opacity. Whenever I change the opacity of the navbar it affects the classes inside of it, even when I specify those classes to have no opacity. I've posted an image of what I'm trying to replicate. As you can see, the links appear in full, but the navbar is invisible, allowing the complete background image to show. It might look like a solid red bar, but I assure you it's an invisible navbar. Any help would be super appreciated! Thanks. Here's my navbar HTML code: <div class="custom_nav