It looks like you put an "
at the end of the line by accident
But after you fix that you get an error about createRadialGradient
not being defined.
From my understnading you are trying to use this function to create a gradient via HTML which I do not know much about. If you want to add a gradient using the createRadialGradient
it looks like you need to do it from some kind of canvas context like how the link above shows.
Another way you could do this is using paper.js (Wick’s renderer)
To access the paper.js object you can use code like the below
CLIP_NAME.activeFrame._children[0].view.item
You can set the fillcolor to a straight color with something like this
CLIP_NAME.activeFrame._children[0].view.item.fillColor = "red";
You can also use an array representing RGB values like [0.8,0.4,0.2]
which is the same as something like #cc6638
which also should work (not sure if it was with or without the #
)
To make a gradient (radial) you set it to an object like this
CLIP_NAME.activeFrame._children[0].view.item.fillColor = {
gradient: {
stops: [ ["blue", 0], ["green",0.3], ["red", 1] ],
radial: true
},
origin: [0,0],
destination: [50,0]
};
The stops
contains the different colors of the gradient with a number (optional) that specifies where along the gradient it should be (from 0 to 1)
origin
and destination
are where the gradient starts and stops from the position of the path in the clip
Something like this would allow for a random colored gradient
CLIP_NAME.activeFrame._children[0].view.item.fillColor = {
gradient: {
stops: [ [[Math.random(),Math.random(),Math.random()]], [[Math.random(),Math.random(),Math.random()]] ],
radial: true
},
origin: [0,0],
destination: [50,0]
};