[SOLVED] The most ever rooky question

I have this code:

var color = '1,0,1';
var final = new pc.Color(color);

What have I to modify/add to make final works?

Use this!

var final = new pc.Color(1, 0, 1);

Or if you want to initialize the object with other variables:

var red = 1;
var green = 0;
var blue = 1;
var final = new pc.Color(red, green, blue);

finally solved, the solution was to use an array instead of a string to initialize the object:

var red = 1;
var green = 0;
var blue = 1;
var rgb = [red,green,blue]
var final = new pc.Color(rgb);

in my particular case the variable rgb I get it through the return of a function.

Leonidas thanks for your fresh mind and make me see that what I was trying to do was impossible by the very laws of the pc.Color builder.

2 Likes