linear-gradients

Is this possible to create 2-axis 4 color gradient in css (bilinear gradient)?

女生的网名这么多〃 提交于 2020-03-13 21:42:59
问题 My exmaple in JavaScript and <canvas> . https://codepen.io/KonradLinkowski/pen/QWbjaPr const canvas = document.querySelector('#box') const ctx = canvas.getContext('2d') const interpolate = (value, start, end) => (end - start) * value + start const interpolateRGB = (value, start, end) => { return { r: interpolate(value, start.r, end.r), g: interpolate(value, start.g, end.g), b: interpolate(value, start.b, end.b) } } const calcColor = (point, topLeft, topRight, bottomLeft, bottomRight) => {

Is this possible to create 2-axis 4 color gradient in css (bilinear gradient)?

你说的曾经没有我的故事 提交于 2020-03-13 21:41:31
问题 My exmaple in JavaScript and <canvas> . https://codepen.io/KonradLinkowski/pen/QWbjaPr const canvas = document.querySelector('#box') const ctx = canvas.getContext('2d') const interpolate = (value, start, end) => (end - start) * value + start const interpolateRGB = (value, start, end) => { return { r: interpolate(value, start.r, end.r), g: interpolate(value, start.g, end.g), b: interpolate(value, start.b, end.b) } } const calcColor = (point, topLeft, topRight, bottomLeft, bottomRight) => {

HTML Canvas gradient only show one color

天涯浪子 提交于 2020-01-30 11:22:44
问题 I'm having problems with Canvas gradient it only shows the last color that I set on gradient.__addColorStop__(offset,color) method. For example here is a piece of my code to understand better: let canvas = document.getElementById('canvas'); let ctx = canvas.getContext('2d'); let gradient = ctx.createLinearGradient(10, 90, 200, 90); gradient.addColorStop(1 / 10, "black"); gradient.addColorStop(1 / 5, "yellow"); gradient.addColorStop(1 / 1, "red"); let circle1 = new Circle(300, 250, 50,

N-point gradient brush polygon fill

拈花ヽ惹草 提交于 2020-01-30 06:26:29
问题 Is it possible to fill a N-gon, for example a 4 point polygon, that has a different color at each point and have GDI+ to do the color blending? I am looking for something like this: but for 4 point shapes. 回答1: After playing around with Hans' idea of using a path filling, I think this will actually be the best way to solve this. However neither a GraphicsPath nor Clipping nor the bounding rectangle are used. Instead we use a special overload that takes a point array; those points are matched

N-point gradient brush polygon fill

好久不见. 提交于 2020-01-30 06:26:05
问题 Is it possible to fill a N-gon, for example a 4 point polygon, that has a different color at each point and have GDI+ to do the color blending? I am looking for something like this: but for 4 point shapes. 回答1: After playing around with Hans' idea of using a path filling, I think this will actually be the best way to solve this. However neither a GraphicsPath nor Clipping nor the bounding rectangle are used. Instead we use a special overload that takes a point array; those points are matched

Reproducing SVG gradient equivalent to CSS gradient with linear-gradient

淺唱寂寞╮ 提交于 2020-01-28 11:14:27
问题 You can create CSS gradients in modern sites with something as simple as: background-image: linear-gradient(red, orange); The goal is to recreate this gradient in SVG, so what percentages are being used by default for each CSS stop? We tinkered with different percentages (e.g., 50/50, 25/75) with the code below, but none of these experiments produced the same gradient. The closest was 10/90, but could someone confirm the default percentages used if you omit them? div { height: 100px;

Reproducing SVG gradient equivalent to CSS gradient with linear-gradient

柔情痞子 提交于 2020-01-28 11:12:51
问题 You can create CSS gradients in modern sites with something as simple as: background-image: linear-gradient(red, orange); The goal is to recreate this gradient in SVG, so what percentages are being used by default for each CSS stop? We tinkered with different percentages (e.g., 50/50, 25/75) with the code below, but none of these experiments produced the same gradient. The closest was 10/90, but could someone confirm the default percentages used if you omit them? div { height: 100px;

Responsive shine animation using linear-gradient as background

霸气de小男生 提交于 2020-01-27 20:52:05
问题 I want to create a shine loading animation which will appear on multiple elements with different background colors. Currently, I'm using background-image gradient and I'm animating the background-position using vw units, but it's not scalable, my elements will have different lengths. Is there a way I can animate background-image with percentage units? The animation created body { background: black; } header { width: 100%; height: 50px; background-color: rebeccapurple; background-image: linear

Is it possible to draw vertical lines via css gradients starting from arbitrary point?

妖精的绣舞 提交于 2020-01-24 14:09:14
问题 I can draw a line in background using linear-gradient or repeating-linear-gradient, for instance: background-color: linen; background-image: repeating-linear-gradient(90deg, black, black 1px, linen 1px, linen 100px); background-position: 100px; I'l get something like: My question would be - what will be the best way to draw such lines from some arbitrary point, not from the very top (or very bottom), say, I want to draw line from the middle of container to the top? Is it possible at all? What

Responsive two gradient diagonal button

China☆狼群 提交于 2020-01-21 19:42:57
问题 I have a button that is split diagonally. I want to add a different gradient to each side. I've tried splitting in two using :before and :after but that requires a rotate or skew which means changing the deg which isn't very responsive. Basically I need the cut off in the center to stay top left and bottom right at different breakpoints regardless of the width and height. Is there a better way to do this? .btn { background-image: linear-gradient(47deg, #f09 0%, #A09 100%); display: inline