Sg2.9
error with GradientColor and...
Recent RSS
error with GradientColor and setAlpha function
From:  Axel
Date:  2. October 2010, 17:26

Hi,

here is another thing i stumbled upon:

if i call the setAlpha function on a gradient color, i get into the following situation:
call:

shape.fillColor.setAlpha(1);

error:

TypeError: Cannot find function setAlpha in object com.scriptographer.ai.GradientColor@15422a8.

so it gets that it is a gradient color, so there ought to be an object, but the function call doesn't work.
Am I handling this the wrong way?

best regards,
Axel

by the way:
in the reference there is a little misspelling: setAlpha(alHPa);

Re: error with GradientColor and setAlpha function
Date:  2. October 2010, 18:04

This should actually be hidden in the reference. Try:

shape.fillColor.alpha = 1
Re: error with GradientColor and setAlpha function
Date:  2. October 2010, 18:08

Actually, if the function did work - it would give the following error: Cannot set alpha on gradient

Setting alpha on gradients is not supported. You can set item.opacity instead:

var path = new Path.Circle(new Point(50, 50), 25);
path.fillColor = 'red';
// Set opacity to 50%:
path.opacity = 0.5;
Re: error with GradientColor and setAlpha function
From:  Axel
Date:  2. October 2010, 19:08

setting the opacity works great!

thanks

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Voronoi Tool 21.01.11