Skip to content

Commit f691b4c

Browse files
author
livecodeali
committed
[[ Docs ]] Document gradient ramp properties and messages
1 parent bcaa9bf commit f691b4c

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

extensions/widgets/gradientrampeditor/gradientrampeditor.lcb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ for more details.
1515
You should have received a copy of the GNU General Public License
1616
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
1717

18+
/*
19+
This widget is displays a gradient according to the value of its *gradientStops* property.
20+
21+
Name: gradientStopsChanged
22+
Type: message
23+
Syntax: on gradientStopsChanged
24+
25+
Example:
26+
on gradientStopsChanged
27+
set the fillGradient["ramp"] of graphic 1 to the gradientStops of the target
28+
end gradientStopsChanged
29+
30+
Description:
31+
Handle the <gradientStopsChanged> message to perform an operation when the gradientStops property of a gradient ramp editor widget changes.
32+
*/
33+
1834
widget com.livecode.widget.gradientRampEditor
1935

2036
metadata title is "Gradient Ramp Editor"
@@ -96,6 +112,31 @@ end handler
96112
-- Property getting and setting
97113
----------------------------------------------------------------------------------------------------
98114

115+
/*
116+
Syntax: set the gradientStops of <widget> to <pGradientStops>
117+
Syntax: get the gradientStops of <widget>
118+
119+
Summary: The <gradientStops> property controls the offset and color of each division of the gradient.
120+
121+
pGradientStops: A list, one per line, of comma-delimited strings consisting of the offset of the gradient stop, followed by the color and alpha.
122+
123+
Example:
124+
-- Create 10 equally spaced stops with random color values
125+
local tGradientStops, tStop
126+
repeat with x = 1 to 10
127+
put x/10 & comma & random(255) & comma & random(255) & comma & random(255) & comma & random(255) into tStop
128+
if tGradientStops is empty then
129+
put tStop into tGradientStops
130+
else
131+
put return & tStop after tGradientStops
132+
end if
133+
end repeat
134+
set the gradientStops of widget "Gradient Ramp Editor" to tGradientStops
135+
136+
Description:
137+
Color gradients are smooth transitions between the colors defined at consecutive offsets. The <gradientStops> property represents the offset and color of each of these stops.
138+
139+
*/
99140
property gradientStops get getGradientStops set setGradientStops
100141

101142
public handler getGradientStops() returns String

0 commit comments

Comments
 (0)