Scripting gradients

Scott Rossi scott at tactilemedia.com
Wed Sep 5 04:58:08 EDT 2012


Gradient settings are stored in an array property called the fillGradient.
The color data is stored the "ramp" index.  So to get the colors, you could
script something like:
put the fillGradient of graphic "myBox" into theArray
put theArray["ramp"] of graphic "myBox" into theVar

The variable theVar will contain each color of the gradient, listed one per
line.

After making changes to the colors, you load the color data back into the
array, and set the fillGradient of the graphic to the array:
put theVar into theArray["ramp"]
set the fillGradient of graphic "myBox" to theArray

See the fillGradient entry in the dictionary for more info.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design



Recently, John Allijn wrote:

> Hi,
> I have a rectangle that I filled with a gradient in the inspector.
> Is there a way to script the colors of this gradient?
> I want to let the user pick a color for a color theme and have the gradient
> match that.
> Thanks!
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 








More information about the use-livecode mailing list