use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class GhostsRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
flame.setCentreX(0.0);
flame.setCentreY(0.0);
flame.setPixelsPerUnit(200);
flame.setCamZoom(2.0);
flame.setCamRoll(-90.0);
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());
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("spherical", true);
xForm.addVariation(0.5 + Math.random(), varFunc);
}
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.05 + Math.random() * 0.15, varFunc).setPriority(Math.random() < 0.5 ? -1 : 1);
}
xForm.setColor(0.4 + Math.random() * 0.2);
xForm.setColorSymmetry(0.82 + Math.random() * 0.16);
XFormTransformService.rotate(xForm, 180, false);
XFormTransformService.scale(xForm, 2.0 + Math.random() * 25.0, true, true, false);
XFormTransformService.localTranslate(xForm, 0.5 * (0.5 - 1.0 * Math.random()), 0.5 - 1.0 * Math.random(), false);
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(1.5 + Math.random());
xForm.setColor(Math.random());
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("linear", true);
xForm.addVariation(0.05 + Math.random() * 0.25, varFunc);
}
if (Math.random() < 0.66) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("radial_blur", true);
varFunc.setParameter("angle", Math.random() * MathLib.M_PI);
xForm.addVariation(0.025 + Math.random() * 0.1, varFunc);
} else {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.05 + Math.random() * 0.5, varFunc);
}
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.05 + Math.random() * 0.5, varFunc).setPriority(Math.random() < 0.5 ? -1 : 1);
}
XFormTransformService.scale(xForm, 0.1 + Math.random() * 0.8, false, true, false);
XFormTransformService.scale(xForm, 1.0 + Math.random() * 3.0, true, false, false);
XFormTransformService.scale(xForm, 0.1 + Math.random() * 0.8, true, true, false);
XFormTransformService.rotate(xForm, 180, false);
XFormTransformService.localTranslate(xForm, 2.0 - 4.0 * Math.random(), 0.5 * (2.0 - 4.0 * Math.random()), false);
xForm.setColorSymmetry(Math.random());
}
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class GnarlRandomFlameGenerator method createWaves2BVariation.
public static VariationFunc createWaves2BVariation(double scaleX, double scaleY, double freqX, double freqY) {
VariationFunc w2;
w2 = VariationFuncList.getVariationFuncInstance("waves2b", true);
double pwx = 3 * Math.random();
if (pwx < 1) {
// typical setting
pwx = 1;
} else if (pwx < 2) {
// advanced
pwx = ((pwx - 1.5) > 0 ? -1.0 : +1.0) * (0.5 + 2.0 * Math.random());
} else {
// geeky functions
pwx = ((pwx - 2.5) > 0 ? -1.0 : +1.0) * 1e-6 * (0.9 - Math.random() * 0.2);
}
double pwy = 3 * Math.random();
if (pwy < 1.5) {
// typical setting
pwy = 1;
} else if (pwy < 2.25) {
// advanced
pwy = ((pwy - 1.5) > 0 ? -1.0 : +1.0) * (0.5 + 2.0 * Math.random());
} else {
// geeky functions
pwy = ((pwy - 2.5) > 0 ? -1.0 : +1.0) * 1e-6;
}
w2.setParameter("pwx", pwx);
w2.setParameter("pwy", pwy);
double scaleinfx = Math.random() < 0.5 ? scaleX : 0.5 - Math.random();
double scaleinfy = Math.random() < 0.5 ? scaleY : 0.5 - Math.random();
w2.setParameter("scaleinfx", scaleinfx);
w2.setParameter("scaleinfy", scaleinfy);
if (Math.random() > 0.75) {
double unity = Math.random() * 10;
unity = unity < 5.0 ? unity - 1.0 : unity + 5.0;
w2.setParameter("unity", unity);
}
if (Math.random() < 0.33) {
double jacok = 0.375 - Math.random() * 0.75;
w2.setParameter("jacok", jacok);
}
w2.setParameter("freqx", freqX);
w2.setParameter("scalex", scaleX);
w2.setParameter("freqy", freqY);
w2.setParameter("scaley", scaleY);
return w2;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class JulianDiscRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(0.0);
flame.setCentreY(0.0);
flame.setCamPitch(0.0);
flame.setCamYaw(0.0);
flame.setCamZoom(1.0);
flame.setCamPerspective(0.0);
flame.setPixelsPerUnit(100);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5 + Math.random() * 0.5);
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("julian", true);
int power = Tools.FTOI(200.0 - Math.random() * 400.0);
if (power == 0 || power == 1 || power == -1) {
power = -30;
}
varFunc.setParameter("power", power);
double[] amounts = { 0.25, 0.5, 0.75 };
xForm.addVariation(amounts[(int) (Math.random() * amounts.length)], varFunc);
if (Math.random() < 0.5) {
String fncName = Math.random() > 0.5 ? getNonBlurRandomFunc() : "gaussian_blur";
xForm.addVariation(0.001 + Math.random() * 0.039, VariationFuncList.getVariationFuncInstance(fncName, true));
}
xForm.setColorSymmetry(-1.0);
xForm.setColor(0.0);
if (Math.random() < 0.33) {
XFormTransformService.globalTranslate(xForm, -0.0125 + 0.025 * Math.random(), -0.0125 + 0.025 * Math.random(), false);
} else if (Math.random() < 0.75) {
XFormTransformService.globalTranslate(xForm, -0.125 + 0.25 * Math.random(), -0.125 + 0.25 * Math.random(), false);
}
if (Math.random() < 0.15) {
XFormTransformService.rotate(xForm, 6.0 - Math.random() * 12.0, false);
} else if (Math.random() < 0.3) {
XFormTransformService.rotate(xForm, -45.0, false);
} else if (Math.random() < 0.75) {
XFormTransformService.rotate(xForm, 90.0 - Math.random() * 180.0, false);
}
if (Math.random() < 0.5) {
XFormTransformService.scale(xForm, 1.2 - Math.random() * 0.4, true, true, false);
}
if (Math.random() < 0.5) {
XFormTransformService.scale(xForm, 1.2 - Math.random() * 0.4, true, true, true);
}
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(2.0 + Math.random() * 24.0);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("disc", true));
if (Math.random() < 0.125) {
String fncName = Math.random() > 0.5 ? getNonBlurRandomFunc() : "gaussian_blur";
xForm.addVariation(0.001 + Math.random() * 0.039, VariationFuncList.getVariationFuncInstance(fncName, true));
}
xForm.setColor(0.5 + Math.random() * 0.5);
xForm.setColorSymmetry(0.6 + Math.random() * 0.33);
if (Math.random() < 0.33) {
XFormTransformService.globalTranslate(xForm, -0.0125 + 0.025 * Math.random(), -0.0125 + 0.025 * Math.random(), false);
} else if (Math.random() < 0.75) {
XFormTransformService.globalTranslate(xForm, -0.125 + 0.25 * Math.random(), -0.125 + 0.25 * Math.random(), false);
}
if (Math.random() < 0.15) {
XFormTransformService.rotate(xForm, 6.0 - Math.random() * 12.0, false);
} else if (Math.random() < 0.3) {
XFormTransformService.rotate(xForm, -45.0, false);
} else if (Math.random() < 0.75) {
XFormTransformService.rotate(xForm, 90.0 - Math.random() * 180.0, false);
}
}
// final
if (Math.random() < 0.15) {
XForm xForm = new XForm();
layer.getFinalXForms().add(xForm);
if (Math.random() < 0.5) {
String[] fncList = { "auger", "bent", "bent2", "boarders", "bubble", "butterfly", "bwraps7", "cosine", "curve", "cylinder", "diamond", "disc", "eclipse", "edisc", "elliptic", "ex", "exp", "exponential", "eyefish", "fan", "fan2", "fisheye", "heart_wf", "hemisphere", "horseshoe", "hyperbolic", "julia", "julia3D", "julia3Dz", "julian", "juliascope", "linearT", "log", "mobius", "ngon", "oscilloscope", "rings", "rings2", "scry", "xtrb", "sec", "sin", "sinh", "sinusoidal", "spherical", "swirl", "tan", "tangent", "tanh", "boarders2", "polar" };
String varName = fncList[(int) (Math.random() * fncList.length)];
xForm.addVariation(2.0 + Math.random() * 2.0, VariationFuncList.getVariationFuncInstance(varName, true));
}
}
flame.getFirstLayer().randomizeColors();
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class SphericalRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(0.0);
flame.setCentreY(0.0);
flame.setCamPitch(0.0);
flame.setCamRoll(90.0);
flame.setCamYaw(0.0);
flame.setCamZoom(2.4);
flame.setCamPerspective(0.32);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
VariationFunc varFunc;
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(4.0 + 12.0 * Math.random());
varFunc = VariationFuncList.getVariationFuncInstance("spherical3D", true);
xForm.addVariation(1.0, varFunc);
// XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
XFormTransformService.rotate(xForm, Math.random() < 0.5 ? Math.random() < 0.5 ? 180.0 : 90 : -90.0, false);
XFormTransformService.globalTranslate(xForm, 1.0, 0.0, false);
xForm.setColor(1.0);
xForm.setColorSymmetry(0.9 + Math.random() * 0.2);
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(3.0 + 11.0 * Math.random());
varFunc = VariationFuncList.getVariationFuncInstance("spherical3D", true);
xForm.addVariation(1.0, varFunc);
// XFormTransformService.rotate(xForm, 90.0, false);
XFormTransformService.rotate(xForm, Math.random() < 0.5 ? Math.random() < 0.5 ? 180.0 : 90 : -90.0, false);
xForm.setColor(0.5);
xForm.setColorSymmetry(0.9 + Math.random() * 0.2);
}
// 3rd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.3 + 0.2 * Math.random());
varFunc = VariationFuncList.getVariationFuncInstance("linear3D", true);
xForm.addVariation(1.0, varFunc);
XFormTransformService.rotate(xForm, 90.0, false);
XFormTransformService.globalTranslate(xForm, (int) (2.0 + Math.random() * 2.0), 0.0, false);
xForm.setColor(Math.random());
xForm.setColorSymmetry(0);
}
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.2 + 0.15 * Math.random());
varFunc = VariationFuncList.getVariationFuncInstance("linear3D", true);
xForm.addVariation(1.0, varFunc);
XFormTransformService.rotate(xForm, 90.0, false);
XFormTransformService.globalTranslate(xForm, -(int) (2.0 + Math.random() * 2.0), 0.0, false);
xForm.setColor(Math.random());
xForm.setColorSymmetry(0);
}
int max = Tools.randomInt(4);
for (int i = 0; i < max; i++) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5 + 0.3 * Math.random());
String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
xForm.addVariation(1.0, varFunc);
XFormTransformService.rotate(xForm, 90.0 - Math.random() * 180.0, false);
XFormTransformService.scale(xForm, 0.2 + 0.2 * Math.random(), true, true);
XFormTransformService.globalTranslate(xForm, 0.25 - Math.random() * 0.5, 0.25 - Math.random() * 0.5, false);
xForm.setColor(Math.random());
xForm.setColorSymmetry(0);
}
flame.getFirstLayer().randomizeColors();
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class SynthRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
// Bases loosely on the SynthRandomBatch Script by slobo777, http://slobo777.deviantart.com/art/Synth-V2-128594088 */
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(0.0);
flame.setCentreY(0.0);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// init
// These vars affect the style of the centre effect
double centre_synth = 0.7;
// 5;
double centre_mode = Tools.randomInt(20);
double centre_noise = .0;
double centre_power = -1.0;
double centre_smooth = 1;
double centre_color = 0.4 + 0.2 * Math.random();
double centre_symmetry = 0.6 + 0.4 * Math.random();
XForm xForm1;
// 1st XForm
{
XForm xForm = xForm1 = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(1.0);
xForm.setColor(0.0);
xForm.setColorSymmetry(-1.0);
VariationFunc synth = VariationFuncList.getVariationFuncInstance("synth");
xForm.addVariation(1.0, synth);
// 3;
synth.setParameter("mode", Tools.randomInt(20));
synth.setParameter("power", -0.2);
int numWaves = (int) (Math.random() * 3.5 + 2);
// Starting circle . . .
synth.setParameter("a", 0.8 + (Math.random() * 0.4));
// Wave #1
synth.setParameter("b", Math.random() * 2);
synth.setParameter("b_type", Tools.randomInt(7));
synth.setParameter("b_frq", Tools.randomInt(7) + 1);
synth.setParameter("b_phs", Math.random() * M_PI);
synth.setParameter("b_layer", Tools.randomInt(4));
// Skew effect?
if (Math.random() < 0.2) {
synth.setParameter("b_skew", Math.random() * 2 - 1);
}
// Exceptionally high frequency?
if (Math.random() < 0.1) {
synth.setParameter("b_frq", Tools.randomInt(20) + 7);
}
// Usually higher frequencies affect the amplitude
if (Math.random() < 0.8) {
synth.setParameter("b", (Double) synth.getParameter("b") / (1 + 0.3 * (Double) synth.getParameter("b_frq")));
}
// Wave #2
synth.setParameter("c", Math.random());
synth.setParameter("c_type", Tools.randomInt(7));
synth.setParameter("c_frq", Tools.randomInt(7) + 1);
synth.setParameter("c_phs", Math.random() * M_PI);
synth.setParameter("c_layer", Tools.randomInt(4));
// Skew effect?
if (Math.random() < 0.2) {
synth.setParameter("c_skew", Math.random() * 2 - 1);
}
// Exceptionally high frequency?
if (Math.random() < 0.1) {
synth.setParameter("c_frq", Tools.randomInt(20) + 7);
}
// Usually higher frequencies affect the amplitude
if (Math.random() < 0.8) {
synth.setParameter("c", (Double) synth.getParameter("c") / (1 + 0.3 * (Double) synth.getParameter("c_frq")));
}
// Wave #3
if (numWaves >= 3) {
synth.setParameter("d", Math.random());
synth.setParameter("d_type", Tools.randomInt(7));
synth.setParameter("d_frq", Tools.randomInt(7) + 1);
synth.setParameter("d_phs", Math.random() * M_PI);
synth.setParameter("d_layer", Tools.randomInt(4));
// Skew effect?
if (Math.random() < 0.2) {
synth.setParameter("d_skew", Math.random() * 2 - 1);
}
// Exceptionally high frequency?
if (Math.random() < 0.1) {
synth.setParameter("d_frq", Tools.randomInt(20) + 7);
}
// Usually higher frequencies affect the amplitude
if (Math.random() < 0.8) {
synth.setParameter("d", (Double) synth.getParameter("d") / (1 + 0.3 * (Double) synth.getParameter("d_frq")));
}
}
// Wave #4
if (numWaves >= 4) {
synth.setParameter("e", Math.random());
synth.setParameter("e_type", Tools.randomInt(7));
synth.setParameter("e_frq", Tools.randomInt(7) + 1);
synth.setParameter("e_phs", Math.random() * M_PI);
synth.setParameter("e_layer", Tools.randomInt(4));
// Skew effect?
if (Math.random() < 0.2) {
synth.setParameter("e_skew", Math.random() * 2 - 1);
}
// Exceptionally high frequency?
if (Math.random() < 0.1) {
synth.setParameter("e_frq", Tools.randomInt(20) + 7);
}
// Usually higher frequencies affect the amplitude
if (Math.random() < 0.8) {
synth.setParameter("e", (Double) synth.getParameter("e") / (1 + 0.3 * (Double) synth.getParameter("e_frq")));
}
}
// Wave #5
if (numWaves >= 5) {
synth.setParameter("f", Math.random());
synth.setParameter("f_type", Tools.randomInt(7));
synth.setParameter("f_frq", Tools.randomInt(7) + 1);
synth.setParameter("f_phs", Math.random() * M_PI);
synth.setParameter("f_layer", Tools.randomInt(4));
// Skew effect?
if (Math.random() < 0.2) {
synth.setParameter("f_skew", Math.random() * 2 - 1);
}
// Exceptionally high frequency?
if (Math.random() < 0.1) {
synth.setParameter("f_frq", Tools.randomInt(20) + 7);
}
// Usually higher frequencies affect the amplitude
if (Math.random() < 0.8) {
synth.setParameter("f", (Double) synth.getParameter("f") / (1 + 0.3 * (Double) synth.getParameter("f_frq")));
}
}
}
// Second "inner" transform is smaller with a little noise
// added to remove annoying lines at the centre
{
XForm xForm = xForm1.makeCopy();
layer.getXForms().add(xForm);
xForm.setWeight(1.0);
xForm.setColor(centre_color);
xForm.setColorSymmetry(centre_symmetry);
VariationFunc synth = xForm.getVariation(0).getFunc();
xForm.getVariation(0).setAmount(centre_synth);
synth.setParameter("power", centre_power);
synth.setParameter("mode", centre_mode);
synth.setParameter("smooth", centre_smooth);
VariationFunc noise = VariationFuncList.getVariationFuncInstance("noise");
xForm.addVariation(centre_noise, noise);
}
if (Math.random() < 0.55) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(5 * Math.random() + 0.125);
xForm.setColor(centre_color + 0.2 * Math.random());
xForm.setColorSymmetry(centre_symmetry - 0.4 * Math.random());
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname());
xForm.addVariation(0.25 + Math.random() * 1.5, varFunc);
xForm.getModifiedWeights()[1] = 0.0;
}
return flame;
}
Aggregations