How do I change the colors of an object, or button?
(Is this where I should be asking this?)
How do I change the colors of an object, or button?
(Is this where I should be asking this?)
right click and go to the objects timeline
Hello, welcome to the forum.
Here are 2 pictures of the process. When you make a clip, go to its timeline. You can find that option in the inspector. In the clip’s timeline, you can edit stuff there.
Nice. Thanks for the reply.
But,
I am aware of doing it that way. I should’ve been more specific. I meant in the coding area. When a button is clicked it changes the color of the button. Or the button changes the color of another object.
Thanks for the reply. But I wasn’t clear in my initial question.
You can use this type of code to refer to an object’s color:
// Fill color
clip.activeFrame._children[0].fillColor
// Stroke-color
clip.activeFrame._children[0].strokeColor
(@pumpkinhead found this code)
If you would like to see an example, here’s one created by @bluecake
clip.activeFrame._children[0].fillColor
change “clip” with the name of the object.
“activeFrame” will refer to the objects current frame
“_children” will bring up an array of objects in that frame
The first object in the array is referred to with the zero
“fillColor” will refer to the color of that object
The object you refer to needs to be a path type of object to have a stroke/ fill color
(edit)
All you have to do is set that to a color, like this:
this.activeFrame._children[0].fillColor="blue";
This stuff isn’t documented, but you can access all the children contained in a frame, and you can access the frames from code inside a clip. All the children includes the paths, and you can access its paper.js object and change its properties. (paper.js is what’s used to render the objects)
So in a clip containing only one frame with only the desired path you want to modify, here is code that changes the path’s fill color to red:
this.activeFrame // get this clip's current frame
._children[0] // get the first child of the frame
.view.item // the paper.js Path object
.fillColor = "red"; // you can also set it to a hex value or read/write its individual components
(more info on fillColor
should be here)
Amazing! Thank you.
Thank you! Gonna try it today.
you can have your object/s with different colours in different frames of a clip.
changing colors will become a simple
myclip.gotoAndStop(x);
or you can change the real color of a shape
have a look here:
you may also find useful to see this one: