Layer layer = flame.getFirstLayer();
layer.getFinalXForms().clear();
layer.getXForms().clear();
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(1.5 + Math.random() * 1.0);
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("curl", true);
varFunc.setParameter("c1", -1.0);
varFunc.setParameter("c2", 0.001 + Math.random() * 0.0199);
xForm.addVariation(1.6 + Math.random() * 0.8, varFunc);
xForm.setColor(0.4 + Math.random() * 0.2);
xForm.setColorSymmetry(0.82 + Math.random() * 0.16);
XFormTransformService.rotate(xForm, 180, false);
XFormTransformService.localTranslate(xForm, 1.0, 0.0, true);
xForm.getModifiedWeights()[0] = 0.0;
xForm.getModifiedWeights()[1] = 1.0;
xForm.getModifiedWeights()[2] = 0.0;
xForm.getModifiedWeights()[3] = 0.0;
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.05 + Math.random() * 0.35);
String fncNames[] = { "juliascope", "julia3D", "julia3Dz", "julian" };
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(fncNames[(int) (fncNames.length * Math.random())], true);
varFunc.setParameter("power", Math.random() < 0.33 ? 2 : Math.random() < 0.5 ? 3 : 4);
xForm.addVariation(1.0, varFunc);
xForm.setColor(0.5 + Math.random() * 0.5);
xForm.setColorSymmetry(0.5);
xForm.getModifiedWeights()[0] = 1.0;
xForm.getModifiedWeights()[1] = 0.0;
xForm.getModifiedWeights()[2] = 1.0;
xForm.getModifiedWeights()[3] = 1.0;
}
// 3rd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.4 + Math.random() * 0.2);
String fncName;
if (Math.random() < 0.33) {
fncName = "bubble";
}
else {
fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length * Math.random())];
}
xForm.addVariation(0.01 + Math.random() * 0.04, VariationFuncList.getVariationFuncInstance(fncName, true));
xForm.addVariation(5.0 + Math.random() * 10.0, VariationFuncList.getVariationFuncInstance("pre_blur", true));
xForm.setColor(0.1 + Math.random() * 0.3);
xForm.setColorSymmetry(0);
XFormTransformService.localTranslate(xForm, -1.0, 0.0, true);
xForm.getModifiedWeights()[0] = 1.0;
xForm.getModifiedWeights()[1] = 1.0;
xForm.getModifiedWeights()[2] = 0.0;
xForm.getModifiedWeights()[3] = 0.0;
}
// 4th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.4 + Math.random() * 0.2);
String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length * Math.random())];
xForm.addVariation(0.01 + Math.random() * 0.04, VariationFuncList.getVariationFuncInstance(fncName, true));
xForm.setColor(0.1 + Math.random() * 0.3);
xForm.setColorSymmetry(0);
XFormTransformService.rotate(xForm, Math.random() * 360.0, true);
XFormTransformService.scale(xForm, 1.1 + Math.random() * 3.0, true, true, true);
xForm.getModifiedWeights()[0] = 1.0;
xForm.getModifiedWeights()[1] = 1.0;
xForm.getModifiedWeights()[2] = 1.0;
xForm.getModifiedWeights()[3] = 1.0;
}
return flame;
}