A "random" Color
10 posts • Page 1 of 1
A "random" Color
Hello I'm wondering if there's a way to spawn circles with this color: [1.0, random color, 0.0, 0.7].
Is there a way to declare just the (0), (2) and (3) parts and let the (1) part be random?
EDIT-----------------------------------------
Without using any scene.my.* variables
Is there a way to declare just the (0), (2) and (3) parts and let the (1) part be random?
EDIT-----------------------------------------
Without using any scene.my.* variables
-

Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: A "random" Color
You could try sin(scene.Time) for (1).
TheWinkits wrote:They both looks of cuking amazing
-

Chronos - [Most Active Member 2010]
- Posts: 4457
- Joined: Mon Aug 31, 2009 6:00 pm
- Location: Californania
Re: A "random" Color
Another way to do this :
- Code: Select all
(e)=>{
object = Scene.addCircle({
radius := 0.05;
pos := e.pos;
});
object.color = [1.0, object.color(1), 0.0, 0.7];
}
- REMqb
- Posts: 15
- Joined: Wed Dec 30, 2009 7:51 pm
- Location: France
Re: A "random" Color
Okey well instead of making a new thread I'll bump this one
. Is there a way to limit REMqb's way so it the color will be random within specific parameters. Here's what I wrote:
Sorry for the bump.
- Code: Select all
(e)=>{
object = Scene.addCircle({
radius := 0.05;
pos := e.pos
});
object.color = [object.color(0), object.color(0), object.color(0), 1.0]
}
Sorry for the bump.
-

Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: A "random" Color
replace object.color(0) by (object.color(0)*(max-min)+min)
you will get :
you will get :
- Code: Select all
(e)=>{
object = Scene.addCircle({
radius := 0.05;
pos := e.pos
});
grey = (object.color(0) * (0.5 - 0.3) + 0.3);
object.color = [grey, grey, grey, 1.0]
}
- REMqb
- Posts: 15
- Joined: Wed Dec 30, 2009 7:51 pm
- Location: France
Re: A "random" Color
I think now (in 1.7.4) you can use Palette so just set it do desire value in script.
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: A "random" Color
but it only allows for HSVA limiting, instead of RGBA.
Jrv wrote:TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.
GTFO newfgt
-

RA2lover - Posts: 607
- Joined: Mon Aug 31, 2009 8:43 pm
- Location: Brazil
10 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests




