gradient

Drawing gradient over image in ios

老子叫甜甜 提交于 2019-11-28 06:35:07
How to create gradient colour look like following image programatically. When you say "apply it over the image as a gradient", do you mean as a mask (revealing the image at the top, having it fade the image to transparent at the bottom)? If that's the case, you can apply that gradient as a mask, using CAGradientLayer : CAGradientLayer *gradientMask = [CAGradientLayer layer]; gradientMask.frame = self.imageView.bounds; gradientMask.colors = @[(id)[UIColor whiteColor].CGColor, (id)[UIColor clearColor].CGColor]; self.imageView.layer.mask = gradientMask; The above does a simple vertical gradient

Gradient along links in D3 Sankey diagram

笑着哭i 提交于 2019-11-28 05:31:33
Here is jsfiddle of a Sankey diagram : I am trying to modify colors of the links so that the color of each link is actually gradient from its source node color to its target node color. (it is assumed that opacity will remain 0.2 or 0.5 depending whether a mouse hovers or not over the link; so links will remain a little "paler" than nodes) I took a look at this nice and instructive example , which draws this gradient filled loop: However, I simply couldn't integrate that solution to mine, it looks too complex for the given task. Also, note that links in original Sankey diagram move while node

How do I stop internet explorer's propriety gradient filter from cutting off content that should overflow?

我是研究僧i 提交于 2019-11-28 05:26:54
I'm using the internet explorer gradient filter in my CSS. It was all going well until I noticed that images that are supposed to extend beyond their containers overflow:visible; are getting clipped as though the container was set to overflow:hidden; I have no idea why this would happen, or how to fix it. Can anyone help? I'm looking at it in IE8 and IE7 This is the css causing the issue, when I comment it out, no more bug: .box{ filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#b4cfe9', endColorstr='#e4eefc'); /* IE6 & IE7 */ -ms-filter: "progid

Transparent Background Image with a Gradient

本小妞迷上赌 提交于 2019-11-28 05:22:22
Today I was designing a transparent PNG background that would only sit in the top left of a div, and the rest of the div would maintain a gradient background for all transparent areas of the PNG, and the rest of the div itself. It might be better to explain through the code I thought might work: #mydiv .isawesome { /* Basic color for old browsers, and a small image that sits in the top left corner of the div */ background: #B1B8BD url('../images/sidebar_angle.png') 0 0 no-repeat; /* The gradient I would like to have applied to the whole div, behind the PNG mentioned above */ background: -moz

Can you use rgba colours in gradients produced with Internet Explorer’s filter property?

淺唱寂寞╮ 提交于 2019-11-28 05:13:36
问题 Internet Explorer’s filter CSS property ( -ms-filter from IE 8) allows you to do CSS gradients, a bit like the -webkit-gradient and -moz-gradient properties (see e.g. question 213750). However, the syntax doesn’t seem to allow for rgba colours, so you can’t do a gradient from a colour to transparent. Is there any way to achieve gradients that end in transparency in IE? 回答1: Stop colors can be specified in #AARRGGBB notation, where AA represents the alpha. For example, #ffff0000 is fully

Calculate the color at a given point on a gradient between two colors?

一世执手 提交于 2019-11-28 04:30:38
So this is essentially the method I would like to write (in Objective-C/Cocoa, using UIColors , but I'm really just interested in the underlying math): + (UIColor *)colorBetweenColor:(UIColor *)startColor andColor:(UIColor *)endColor atLocation:(CGFloat)location; So as an example, say I have two colors, pure red and pure blue. Given a linear gradient between the two, I want to calculate the color that's at, say, the 33% mark on that gradient: So if I were to call my method like so: UIColor *resultingColor = [UIColor colorBetweenColor:[UIColor redColor] andColor:[UIColor blueColor] atLocation:0

SVG gradient using CSS

断了今生、忘了曾经 提交于 2019-11-28 03:53:15
I'm trying to get a gradient applied to an SVG rect element. Currently, I'm using the fill attribute. In my CSS file: rect { cursor: pointer; shape-rendering: crispEdges; fill: #a71a2e; } And the rect element has the correct fill color when viewed in the browser. However, I'd like to know if I can apply a linear gradient to this element? Thomas W Just use in the CSS whatever you would use in a fill attribute. Of course, this requires that you have defined the linear gradient somewhere in your SVG. Here is a complete example: rect { cursor: pointer; shape-rendering: crispEdges; fill: url(

ggplot: How to produce a gradient fill within a geom_polygon

泄露秘密 提交于 2019-11-28 03:30:22
问题 This should be fairly easy but I can't find my way thru. tri_fill <- structure( list(x= c(0.75, 0.75, 2.25, 3.25), y = c(40, 43, 43, 40)), .Names = c("x", "y"), row.names = c(NA, -4L), class = "data.frame",Integrated=NA, Related=NA) # install.packages("ggplot2", dependencies = TRUE) require(ggplot2) ggplot(data=tri_fill,aes(x=x, y=y))+ geom_polygon() + scale_fill_gradient(limits=c(1, 4), low = "lightgrey", high = "red") What I want is a gradient along the x-axis, but with the above I only get

How to draw a smooth/dithered gradient on a canvas in Android

♀尐吖头ヾ 提交于 2019-11-28 03:20:37
Several answers mention to use GradientDrawable.setDither(true) to draw smooth gradients in Android. That has no effect in my code. Any idea what I have to change to get a well looking gradient in my live wallpaper? GradientDrawable gradient = new GradientDrawable(Orientation.TL_BR, colors); gradient.setGradientType(GradientDrawable.RADIAL_GRADIENT); gradient.setGradientRadius(canvas.getWidth() * 2); gradient.setDither(true); gradient.setGradientCenter(-0.1f, -0.1f); gradient.setBounds(cb); gradient.draw(canvas); Eric Schlenz Seeing as you have a Canvas to work with. Here is one option.

angle attribute in android gradient

亡梦爱人 提交于 2019-11-28 03:08:04
I am going through test example. Where for some Image background they are using gradient, the code goes like this <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#ff0000" android:centerColor="#00ff00" android:endColor="#0000ff" android:angle="180"/> <corners android:radius="5dp" /> </shape> In the above xml I didn't get angle attribute. but when I change the value of angle slightly the pattern slants. Can anyone explain me how exactly it works? karn Gradient basically represents the variation in space(in a