gradient

createRadialGradient and transparency

泪湿孤枕 提交于 2019-12-10 04:30:28
问题 I'm playing around with createRadialGradient() on HTML5 canvas. It works like a charm, except when I'm trying to implement (semi-)transparency. I made this jsFiddle to make things hopefully clearer: http://jsfiddle.net/rfLf6/1/. function circle(x, y, r, c) { ctx.beginPath(); var rad = ctx.createRadialGradient(x, y, 1, x, y, r); rad.addColorStop(0, c); rad.addColorStop(1, 'transparent'); ctx.fillStyle = rad; ctx.arc(x, y, r, 0, Math.PI*2, false); ctx.fill(); } ctx.fillRect(0, 0, 256, 256);

ChartJS Doughnut Charts Gradient Fill

柔情痞子 提交于 2019-12-09 17:10:35
问题 So I tried to make a gradient fill for the ChartJS doughnut chart, but this only works horizontal and not in a circle. This is the code that I'm using: var ctx = document.getElementById("chart-area").getContext("2d"); var gradient1 = ctx.createLinearGradient(0, 0, 0, 175); gradient1.addColorStop(0.0, '#ACE1DB'); gradient1.addColorStop(1.0, '#7FBDB9'); var gradient2 = ctx.createLinearGradient(0, 0, 400, 400); gradient2.addColorStop(0, '#B5D57B'); gradient2.addColorStop(1, '#98AF6E'); var

LinearGradient Center Animation

♀尐吖头ヾ 提交于 2019-12-09 15:53:40
问题 I want to animate the center of a linear gradient, so that at the beginning the whole drawable is color1 and at the end the whole drawable is color2 and in between the center of the gradient moves from left to right. GradientDrawable gd = new GradientDrawable( GradientDrawable.Orientation.LEFT_RIGHT, new int[] {color1, color2}); gd.setCornerRadius(0f); gd.setGradientCenter(x, 0); view.setBackgroundDrawable(gd); The problem is that setGradientCenter doesn't make any difference. According to

How to plot grad(f(x,y))?

扶醉桌前 提交于 2019-12-09 13:36:43
问题 I want to calculate and plot a gradient of any scalar function of two variables. If you really want a concrete example, lets say f=x^2+y^2 where x goes from -10 to 10 and same for y. How do I calculate and plot grad(f)? The solution should be vector and I should see vector lines. I am new to python so please use simple words. EDIT: @Andras Deak: thank you for your post, i tried what you suggested and instead of your test function (fun=3*x^2-5*y^2) I used function that i defined as V(x,y);

Rounded rect with Gradient color

为君一笑 提交于 2019-12-09 12:36:48
问题 I have not really done much programming with Core Graphics. And I tend to stick with QuartzCore now that it does a lot of what I need through the layer property :) However, I have a UIView, which is currently gradient. I'd like to add rounded corners to this UIView and the layer property does not do this when I draw the gradient: - (void)drawRect:(CGRect)rect { CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGGradientRef glossGradient; CGColorSpaceRef rgbColorspace; size_t num

Google Now gradient/shadow on status bar & navigation bar

主宰稳场 提交于 2019-12-09 09:28:19
问题 I'm trying to make a similar status bar and navigation bar gradient as Google Now. Image Reference: Rectangular area indicated as below After trying the below option on Android Marshmallow, <item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentStatus">true</item> I get the below behaviour Image Reference: Can anyone suggest me how to get gradient on both these ? Is that a gradient or is that a shadow ? 回答1: It is a gradient being used as a scrim. To

Simulating color stops in gradients for IE

我与影子孤独终老i 提交于 2019-12-09 02:59:25
问题 I want to give a div a gradient with multiple color-stops, which IE's filter property does not support. Anyone have a creative workaround to simulate the color stops in IE? I already thought of creating multiple divs right next to each other... anything else? Thanks! 回答1: Multiple divs with coordinated gradient colors is the best way (short of using images) to create 3+ color gradients. See fiddle below for a working test: http://jsfiddle.net/Hauhx/ 回答2: I'd recommend you to use a background

Gradient styles

梦想的初衷 提交于 2019-12-08 17:36:02
问题 In my Android application I've hidden the default title bar, introduced a TabView and added my own titlebar under that TabView's tabs. At the moment, I'm using the ?android:attr/windowTitleStyle style which makes my new titlebar look gray and gradient. It looks pretty good, but my screens are looking pretty grayscale. I'd like to spice things up a bit by making this titlebar a different color gradient. What am I looking at here? Creating my own image and using it? The ?android:attr

ios, can't get correct pixel color of CGImageRef

∥☆過路亽.° 提交于 2019-12-08 14:39:02
问题 I made a context, then a gradient. After that I am drawing to the context. Then I receive an gradiented image from context and it is correct, I can see it in the debugger. But when I try to get a pixel color for a specific value it isn't correct. I appreciate any help, thanks. Here is the code. - (UIColor*) getColorForPoint: (CGPoint) point imageWidth: (NSInteger) imageHeight { CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); // create a gradient CGPoint startPoint = CGPointMake(0,

repeat image in iOs

最后都变了- 提交于 2019-12-08 11:24:08
问题 I have an image which is 1*90 with gradient and i want to use it as background for different height say for example for first row of height 90 then no issues but second one is 100 then third is of 80... hw do I do this? 回答1: try + [UIColor colorWithPatternImage:] 回答2: self.someImage = [[UIImage imageNamed:@"yourImage.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 10, 0)]; that will resize image and keep 10 pixels at top, 0 at left, 10 at bottom and 0 at right. You can also try self