vector gradient(list vectors, float rangestart, float rangeend, float index)
{
//////////////////////////////////////////////////////
///originally coded by TigroSpottystripes Katsu////
//////////////////////////////////////////////////////
// this function take as input a list containg vectors, a float specifying the min range of the input and another for the end,
//and finally a float indication which point of the gradient ramp the result will be
float transfindex = ((index - rangestart)/(rangeend - rangestart)) * (llGetListLength(vectors)- 1);//converts the index to the range of the vetors list
integer pos = llFloor(transfindex); //get the position on the list
float firstmulti = (1-(transfindex-pos)); // the multiplier for the first vector
float secondmulti = (transfindex-pos); //the multiplier for the second vector
vector firstvec= (llList2Vector(vectors, pos) * firstmulti); //set how much of the first vector will be passed
vector secondvec = (llList2Vector(vectors, pos+1) * secondmulti); //same thign but with the next vector
vector newvec = firstvec + secondvec ; //mix the two
return newvec; //and the cross-fade is done =^.^=
}
Examples