Programmatically change fill color

I’d love to programmatically change fill color of shapes or at least hue of clips
is there any method to do it?

Ok, I didn’t make this a 100% b/c I used the built-in text box, but now you’ll just have to type color, and the object will turn to that color “programmatically.”
My Project10-16-2020_8-24-45AM.wick (5.5 KB)
let me know if this is any help

(this example really just makes a new shape, but the fill color is changed through code)

that is interesting hamzah but it is also scary :smiley:
i’m not even sure I understand it completely
it wont work with complex shape? it always produce a new rectangle? right?

that also highlights the fact that it’s very difficult to find all the scripts in the project in wick

1 Like

The rectangle that it makes is supposed to be the same size as the clip that it is connected to
(changing the size of the clip in the clips timeline changes the size). idk how 2 make complex shapes

I do agree with you, it is somewhat confusing, but here’s the source that I used:

hamzah i see you using paperjs in your example
is that a standard library in wick?

Wick kinda uses paper.js, and there’s a WHOLE REFERENCE of code you can find on paper.js’s site, but there are stuff in there that wick doesn’t use, but it’s still helpful


I recommend u check it out.

Also,


It’s way easier to change the color of a text object than a clip, try this:

TEXTNAME.strokeColor = 'blue';
TEXTNAME.fillColor = 'red';
1 Like

yup.I knew about text
I wonder if it’s possible to target unnamed shapes inside clip through parent, children, fistChild… paperjs object hierarchy

idk if this is possible, but I guess not at the moment.

Hmmm, @Luxapodular, maybe u can add this in the future :star2:

If wick allowed us to name shapes without grouping them (just like how the text object can be named), then it would’ve been easier to change their colors.

it would be really helpful

clip.activeFrame._children

Also I think the paper.js library is just used for the rendering part.

1 Like

Pumpkin you are my hero! :smiley:

unnamedShapeChangeColor.wick (5.0 KB)

it works with primitive shapes, freehand drawing and imported svg
that will open up to a new level of customization at almost no added download weight
where do you get informations on all the wick hierarchy, objects, methods…?

1 Like

i write console.log(this) in a script and look at the dev console

thankyou very much !