How to set color and tracers on spawned objects?

About advanced scenes, and the Thyme scripting language used in Algodoo.

How to set color and tracers on spawned objects?

Postby pnvv » Sun Aug 31, 2014 12:35 am

Not really much I can say that the title doesn't already tell you ;)
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America

Re: How to set color and tracers on spawned objects?

Postby faytree » Sun Aug 31, 2014 3:53 am

you mean on how to spawn an object with a tracer that has a color that you want,huh? :|
waiting for semester break to come...
User avatar
faytree
 
Posts: 947
Joined: Mon Nov 05, 2012 1:37 pm
Location: Selangor, Malaysia

Re: How to set color and tracers on spawned objects?

Postby pnvv » Sun Aug 31, 2014 4:16 am

Yes. That's exactly what I want.
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America

Re: How to set color and tracers on spawned objects?

Postby faytree » Sun Aug 31, 2014 7:53 am

Simple! Here's the example code! :
Code: Select all
    scene.AddCircle({
        color := [0, 0, 1, 1];
        radius := 0.1;
        pos := pos
    });
    scene.addPen({
        Size := 0.1;
        color = [1, 0, 0, 1];
        pos := pos
    })

i hope that it helps you out ;)
Attachments
Help_1.phz
Example scene (Algodoo only)
(5.58 KiB) Downloaded 49 times
waiting for semester break to come...
User avatar
faytree
 
Posts: 947
Joined: Mon Nov 05, 2012 1:37 pm
Location: Selangor, Malaysia

Re: How to set color and tracers on spawned objects?

Postby pnvv » Sun Aug 31, 2014 3:08 pm

Helped me very much. But I have another question: Where to access the numbers that define the color. I looked at the "appearance" option and I just got a bunch of percentages.
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America

Re: How to set color and tracers on spawned objects?

Postby faytree » Sun Aug 31, 2014 4:26 pm

Well,that's very simple.But remember,Algodoo has2 color variables which is:
1.Color
2.ColorHSVA

both of those variables works differently,
for example:
Code: Select all
Color = [Red,Green,Blue,Appearance]
so,if i want to make a yellow color,i'll write:
[1,1,0,1] into the Color variable
and if i want to make a purple color,i'll write:
[1,0,1,1] into the Color variable

While,ColorHSVA is way more different than the Color variable.
For example:
Code: Select all
ColorHSVA = [Hue,Saturation,Value,Appearance]
if i want to make a bright yellow color,i'll write:
[60,1,1,1] into the ColorHSVA variable
and if i want to make a dark yellow color,i'll write:
[60,1,1,0.5,1] into the ColorHSVA variable

i hope that it helps ;)
waiting for semester break to come...
User avatar
faytree
 
Posts: 947
Joined: Mon Nov 05, 2012 1:37 pm
Location: Selangor, Malaysia

Re: How to set color and tracers on spawned objects?

Postby electronicboy » Sun Aug 31, 2014 7:14 pm

It's worth noting that each value is linked, as in, you update one, the other will be updated. the RGBA is probably the easiest, RGB is the relevant colours, you may remember the 0-255 ranges in other applications, it's pretty much the exact same just divided into a range of 0-1. As for A, Alpha, is the transparent of the object for a more accurate term!
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: How to set color and tracers on spawned objects?

Postby pnvv » Sun Aug 31, 2014 9:21 pm

Both you guys helped a lot. Thank you very much.
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests