Skip to content

Commit 9fcc94f

Browse files
committed
gradients
1 parent bb66b0b commit 9fcc94f

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/ops/base/Ops.Color.Gradient/Ops.Color.Gradient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function updateGradient(keys)
7070
for (let i = 0; i < keys.length - 1; i++)
7171
{
7272
const key = {
73-
"pos": i / keys.length,
73+
"pos": keys[i].pos,
7474
"r": keys[i].r,
7575
"g": keys[i].g,
7676
"b": keys[i].b,

src/ops/base/Ops.Color.Gradient/Ops.Color.Gradient.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
"type": "new op",
3838
"author": "pandur",
3939
"date": 1764014424678
40+
},
41+
{
42+
"message": "Fix output position of color ",
43+
"type": "bugfix",
44+
"author": "pandur",
45+
"date": 1765801585944
4046
}
4147
],
4248
"license": "MIT",

src/ops/base/Ops.Html.ElementGradientBg/Ops.Html.ElementGradientBg.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const
22
inEle = op.inObject("Element", null, "element"),
33
inType = op.inSwitch("Type", ["linear", "radial", "conic"], "linear"),
4-
54
inRCS = op.inDropDown("Rect Color Space", ["srgb", "srgb-linear",
6-
"hsl", "hwb", "lch",
7-
"display-p3", "a98-rgb", "prophoto-rgb", "rec2020", "lab", "oklab", "yz", "xyz-d50", "yz-d65"
5+
"hsl", "hwb", "lch", "lab", "oklab",
6+
"display-p3", "a98-rgb", "prophoto-rgb", "rec2020", "yz", "xyz-d50", "yz-d65"
87
], "srgb"),
98
// inHue = op.inDropDown("Hue interpolation", ["shorter", "longer", "increasing", "decreasing"], "shorter"),
109
inAngle = op.inFloat("Angle", 0),
@@ -51,7 +50,9 @@ function update()
5150

5251
for (let i = 0; i < keys.length; i++)
5352
{
54-
let p = keys[i].pos * 100;
53+
let p = keys[i].pos * 100 + "% ";
54+
// if(inType.get()=="conic")p=(keys[i].pos * 360)+"deg";
55+
5556
str += "rgb(";
5657
str += Math.round(keys[i].r * 255);
5758
str += ",";
@@ -60,7 +61,7 @@ function update()
6061
str += Math.round(keys[i].b * 255);
6162
str += ",";
6263
str += keys[i].a;
63-
str += ") " + p + "% ";
64+
str += ") " + p;
6465

6566
if (i < keys.length - 1) str += ",\n";
6667
}

0 commit comments

Comments
 (0)