Package org.jwildfire.create.tina.base

Examples of org.jwildfire.create.tina.base.Layer


    return pFlame;
  }

  @Override
  protected Flame postProcessFlame(Flame pFlame) {
    Layer layer = pFlame.getFirstLayer();
    if (Math.random() > 0.33) {
      for (Variation var : layer.getFinalXForms().get(0).getVariations()) {
        if (var.getFunc().getName().equalsIgnoreCase(PostDCZTranslFunc.VARNAME)) {
          double factor = (Double) var.getFunc().getParameter("factor");
          var.getFunc().setParameter("factor", factor * 2.0);
        }
      }
View Full Code Here


      if (xf.getDrawMode() == DrawMode.HIDDEN)
        continue;
      else if ((xf.getDrawMode() == DrawMode.OPAQUE) && (pContext.random() > xf.getOpacity()))
        continue;

      Layer layer = flame.getFirstLayer();
      List<XForm> finalXForms = layer.getFinalXForms();
      if (finalXForms.size() > 0) {
        finalXForms.get(0).transformPoint(pContext, pAffineTP, pVarTP, p, q);
        for (int i = 1; i < finalXForms.size(); i++) {
          finalXForms.get(i).transformPoint(pContext, pAffineTP, pVarTP, q, q);
        }
View Full Code Here

  }

  @Override
  public void init(FlameTransformationContext pContext, Layer pLayer, XForm pXForm, double pAmount) {
    if (flame != null) {
      Layer layer = flame.getFirstLayer();
      layer.refreshModWeightTables(pContext);
      xf = layer.getXForms().get(0);
      p = new XYZPoint();
      p.x = 2.0 * pContext.random() - 1.0;
      p.y = 2.0 * pContext.random() - 1.0;
      p.z = 0.0;
      p.color = pContext.random();
View Full Code Here

  @Override
  protected Flame prepareFlame(RandomFlameGeneratorState pState) {
    // Bases loosely on the W2R Batch Script by parrotdolphin.deviantart.com */
    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
    double scaleX = Math.random() * 0.04 + 0.04;
    if (Math.random() > 0.75) {
      scaleX = 0 - scaleX;
    }

    double scaleY = Math.random() * 0.04 + 0.04;
    if (Math.random() > 0.75) {
      scaleY = 0 - scaleY;
    }
    else if (Math.random() < 0.25) {
      scaleY = scaleX;
    }

    double freqX, freqY;

    if (Math.random() < 0.5) {
      freqX = Math.random() * 2.0 + 2.0;
      if (Math.random() > 0.5) {
        freqY = freqX;
      }
      else {
        freqY = Math.random() * 2.0 + 2.0;
      }
    }
    else {
      freqX = -Math.random() * 2.0 + 2.0;
      if (Math.random() > 0.5) {
        freqY = freqX;
      }
      else {
        freqY = -Math.random() * 2.0 + 16.0;
      }
    }

    double blurAmount = 0.0025 * Math.random();
    if (Math.random() < 0.33) {
      blurAmount = 0.0 - blurAmount;
    }
    double wavesWeight = Math.random() * 15 + 135;
    double _2ndWeight = 0.5;
    double _3rdWeight = 0.5;
    double symmetry = 0.7 + Math.random() * 0.3;
    int sides = (int) (Math.random() * 8.0 + 3.0);
    // 1st XForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(wavesWeight);
      VariationFunc w2 = Math.random() > 0.89 ? createWaves2Variation(scaleX, scaleY, freqX, freqY) : createWaves2BVariation(scaleX, scaleY, freqX, freqY);
      xForm.addVariation(1 + Math.random() * 0.001, w2);

      String varLst[] = { "blur", "cos", "exp", "exponential", "lazysusan", "ngon", "sech", "sinh", "epispiral_wf", "tanh", "twintrian", "epispiral" };
      String varName = Math.random() > 0.25 ? varLst[(int) (Math.random() * varLst.length)] : VariationFuncList.getRandomVariationname();
      xForm.addVariation(blurAmount, VariationFuncList.getVariationFuncInstance(varName, true));
      xForm.setColorSymmetry(symmetry);
      xForm.setColor(0.9);
      if (Math.random() > 0.5) {
        XFormTransformService.scale(xForm, 0.995, true, true);
      }
      double angle, tx, ty;
      switch (sides) {
        case 3:
          angle = -120;
          tx = Math.random() * 8 - 4;
          ty = Math.random() * 8 - 4;
          break;
        case 4:
          angle = -90;
          tx = Math.random() * 8 - 4;
          ty = Math.random() * 8 - 4;
          break;
        case 5:
          angle = -72;
          tx = Math.random() * 7 - 3.5;
          ty = Math.random() * 7 - 3.5;
          break;
        case 6:
          angle = -60;
          tx = Math.random() * 7 - 3.5;
          ty = Math.random() * 7 - 3.5;
          break;
        case 7:
          angle = -51.42857;
          tx = Math.random() * 6 - 3;
          ty = Math.random() * 6 - 3;
          break;
        case 8:
          angle = -135;
          tx = Math.random() * 6 - 3;
          ty = Math.random() * 6 - 3;
          break;
        case 9:
          angle = -40;
          tx = Math.random() * 5 - 2.5;
          ty = Math.random() * 5 - 2.5;
          break;
        case 10:
          angle = -36;
          tx = Math.random() * 4 - 2;
          ty = Math.random() * 4 - 2;
          break;
        default:
          throw new IllegalStateException();
      }
      XFormTransformService.rotate(xForm, angle);
      XFormTransformService.localTranslate(xForm, tx * 1.5, ty * 1.5);
    }
    // 2nd XForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(_2ndWeight);
      int f = (int) (Math.random() * 3);
      switch (f) {
        case 0:
          xForm.addVariation(Math.random() * 0.37 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          break;
        case 1:
          xForm.addVariation(Math.random() * 0.37 + 0.3, VariationFuncList.getVariationFuncInstance("bubble", true));
          xForm.addVariation(Math.random() * 0.37 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          break;
        case 2:
          xForm.addVariation(Math.random() * 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
          JuliaNFunc juliaN = (JuliaNFunc) VariationFuncList.getVariationFuncInstance("julian", true);
          juliaN.setParameter("power", 50 - Math.random() * 100);
          juliaN.setParameter("dist", Math.random() * 10 - 2);
          xForm.addVariation(Math.random() * 0.06 + 0.1, juliaN);
          break;
      }
      xForm.setColorSymmetry(-1);
    }
    // 3rd XForm
    if (Math.random() > 0.75) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(_3rdWeight);
      xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
      XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0);
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random());
      xForm.setColorSymmetry(-1);
View Full Code Here

public class BubblesRandomFlameGenerator extends RandomFlameGenerator {

  @Override
  protected Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    flame.setCamZoom(0.5);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    int fncCount = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
    // 1st xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(12.0 + Math.random() * 80.0);
      xForm.addVariation(2 + Math.random() * 4, VariationFuncList.getVariationFuncInstance("spherical", true));

      String fName;
      if (Math.random() < 0.15) {
        fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * fncCount)];
      }
      else {
        fName = Math.random() < 0.8 ? "eyefish" : "fisheye";
      }
      xForm.addVariation(0.05 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance(fName, true));
      xForm.setColorSymmetry(0.991 + Math.random() * 0.08);
      XFormTransformService.scale(xForm, 0.5 - Math.random() * 0.5, true, true, false);
      XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0, false);
      XFormTransformService.localTranslate(xForm, 3.0 - 6.0 * Math.random(), 3.0 - 6.0 * Math.random(), false);
      if (Math.random() < 0.33) {
        XFormTransformService.localTranslate(xForm, 0.75 - 1.5 * Math.random(), 0.75 - 1.5 * Math.random(), true);
      }
    }
    // 2nd xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 0.8);
      if (Math.random() < 0.05) {
        xForm.addVariation(0.01 + Math.random() * 0.4, VariationFuncList.getVariationFuncInstance("bubble", true));
        VariationFunc checks = VariationFuncList.getVariationFuncInstance("checks", true);
        checks.setParameter("size", 5.0);
        checks.setParameter("x", 3.0);
        checks.setParameter("y", 3.0);
        xForm.addVariation(0.01 + Math.random() * 0.04, checks);
      }
      else {
        xForm.addVariation(0.1 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("bubble", true));
      }
      xForm.addVariation(4 + Math.random() * 2, VariationFuncList.getVariationFuncInstance("pre_blur", true));
      xForm.setColorSymmetry(-0.5);
      XFormTransformService.scale(xForm, 1.1 + Math.random() * 1.9, true, true, false);
      XFormTransformService.localTranslate(xForm, 0.75 - 1.50 * Math.random(), 0.75 - 1.50 * Math.random(), false);
      XFormTransformService.rotate(xForm, 30 - Math.random() * 60.0, false);
    }

    // 3rd xForm
    if (Math.random() > 0.25) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 1.5);
      String fName;
      if (Math.random() > 0.8) {
        fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * fncCount)];
      }
      else {
        fName = Math.random() > 0.5 ? "linear3D" : "noise";
      }
      xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fName, true));
      xForm.setColorSymmetry(-0.5);
      XFormTransformService.rotate(xForm, 30.0 - Math.random() * 60.0, false);
      if (Math.random() < 0.5) {
        XFormTransformService.scale(xForm, 0.5 + Math.random() * 1.5, true, true, false);
      }
    }
    // 4th xForm
    if (Math.random() > 0.5) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 1.5);
      String fName;
      if (Math.random() > 0.8) {
        fName = Math.random() > 0.75 ? VariationFuncList.getRandomVariationname() : ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * fncCount)];
      }
View Full Code Here

public class RaysRandomFlameGenerator extends RandomFlameGenerator {

  @Override
  protected Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCamRoll(Math.random() * 360.0);
    flame.setCamZoom(1.0 + Math.random() * 0.75);
    flame.setGamma(1.2 + Math.random() * 0.8);
    flame.setGammaThreshold(Math.random() * 0.15);
    flame.setBrightness(2.5 + Math.random() * 1.5);

    flame.setCamPitch(0);
    flame.setCamYaw(0);
    flame.setCamPerspective(0);
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // create a random gradient
    layer.setPalette(new TwoColorsRandomGradientGenerator().generatePalette(2, true));

    // create transform 1
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.1 + Math.random() * 0.7);
      xForm.setColor(0);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(-0.43686351); // a
      xForm.setCoeff10(0.63649767); // b
      xForm.setCoeff20(0.7325555); // e
      xForm.setCoeff01(-0.59864436); // c
      xForm.setCoeff11(-0.50111868); // d
      xForm.setCoeff21(0.08008955); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      // variation 1
      xForm.addVariation(0.125 + Math.random() * 0.125, VariationFuncList.getVariationFuncInstance("linear", true));
      // variation 2
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("julian", true);
        varFunc.setParameter("power", 3);
        varFunc.setParameter("dist", 1);
        xForm.addVariation(0.6 + Math.random() * 0.4, varFunc);
      }
      // variation 3
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("juliascope", true);
        varFunc.setParameter("power", 6);
        varFunc.setParameter("dist", 1);
        xForm.addVariation(0.6 + Math.random() * 0.3, varFunc);
      }
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
      XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.5, true, true, false);
      XFormTransformService.rotate(xForm, 360.0 * Math.random(), false);
    }
    // create transform 2
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.23272111);
      xForm.setColor(0.8);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(-0.15514012); // a
      xForm.setCoeff10(0.20816567); // b
      xForm.setCoeff20(0.19004075); // e
      xForm.setCoeff01(-0.15087636); // c
      xForm.setCoeff11(0.20174952); // d
      xForm.setCoeff21(-0.04671182); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      // variation 1
      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
      // variation 2
      {
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("juliascope", true);
        varFunc.setParameter("power", 2);
        varFunc.setParameter("dist", 1);
        xForm.addVariation(0.25 + Math.random() * 0.5, varFunc);
      }

      String fName;
      if (Math.random() < 0.33) {
        int idx = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
        fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (Math.random() * idx)];
      }
      else {
        fName = VariationFuncList.getRandomVariationname();
      }
      xForm.addVariation(0.18 - Math.random() * 0.36, VariationFuncList.getVariationFuncInstance(fName, true));
      XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
      XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.5, true, true, false);
      XFormTransformService.rotate(xForm, 360.0 * Math.random(), false);
    }
    // create transform 3
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.1);
      xForm.setColorSymmetry(0.75);

      xForm.setCoeff00(0.92931929); // a
      xForm.setCoeff10(0.17076568); // b
      xForm.setCoeff20(0.15869232); // e
      xForm.setCoeff01(-0.02999303); // c
      xForm.setCoeff11(0.67104838); // d
      xForm.setCoeff21(-0.19510192); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      // variation 1
      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // create transform 4
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.15);
      xForm.setColorSymmetry(0.75);

      xForm.setCoeff00(0.53699507); // a
      xForm.setCoeff10(0.12206942); // b
      xForm.setCoeff20(-0.0380713); // e
      xForm.setCoeff01(0.23469299); // c
      xForm.setCoeff11(0.79862481); // d
      xForm.setCoeff21(0.04291273); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);
      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // create transform 5
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.2);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(0.89779523); // a
      xForm.setCoeff10(-0.23112747); // b
      xForm.setCoeff20(-0.4497571); // e
      xForm.setCoeff01(0.1734196); // c
      xForm.setCoeff11(0.94619577); // d
      xForm.setCoeff21(-0.0672393); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // create transform 6
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.04166667);
      xForm.setColor(0.25);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(0.70624241); // a
      xForm.setCoeff10(0.15652237); // b
      xForm.setCoeff20(0.43007701); // e
      xForm.setCoeff01(-0.04953437); // c
      xForm.setCoeff11(0.78838922); // d
      xForm.setCoeff21(0.21371425); // f

      xForm.setPostCoeff00(1);
      xForm.setPostCoeff10(0);
      xForm.setPostCoeff01(0);
      xForm.setPostCoeff11(1);
      xForm.setPostCoeff20(0);
      xForm.setPostCoeff21(0);

      xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear", true));
    }
    // final transform
    if (Math.random() > 0.33) {
      XForm xForm = new XForm();
      layer.getFinalXForms().add(xForm);
      String finals[] = { "falloff2", "bwrands", "bwraps7", "cosine", "falloff3", "bwrands", "bwrands", "falloff2" };
      VariationFunc var = VariationFuncList.getVariationFuncInstance(finals[(int) (Math.random() * finals.length)], true);
      if (var.getName().equals("bwrands")) {
        var.setParameter("seed", (int) (Math.random() * Short.MAX_VALUE));
        var.setParameter("minpetals", (int) (3 + Math.random() * 3));
 
View Full Code Here

  @Override
  protected 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;
    double centre_mode = (int) (20 * Math.random()); //5;
    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);
      synth.setParameter("mode", (int) (20 * Math.random())); //3;
      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", (int) (Math.random() * 7));
      synth.setParameter("b_frq", (int) (Math.random() * 7 + 1));
      synth.setParameter("b_phs", Math.random() * M_PI);
      synth.setParameter("b_layer", (int) (Math.random() * 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", (int) (Math.random() * 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", (int) (Math.random() * 7));
      synth.setParameter("c_frq", (int) (Math.random() * 7 + 1));
      synth.setParameter("c_phs", Math.random() * M_PI);
      synth.setParameter("c_layer", (int) (Math.random() * 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", (int) (Math.random() * 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", (int) (Math.random() * 7));
        synth.setParameter("d_frq", (int) (Math.random() * 7 + 1));
        synth.setParameter("d_phs", Math.random() * M_PI);
        synth.setParameter("d_layer", (int) (Math.random() * 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", (int) (Math.random() * 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", (int) (Math.random() * 7));
        synth.setParameter("e_frq", (int) (Math.random() * 7 + 1));
        synth.setParameter("e_phs", Math.random() * M_PI);
        synth.setParameter("e_layer", (int) (Math.random() * 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", (int) (Math.random() * 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", (int) (Math.random() * 7));
        synth.setParameter("f_frq", (int) (Math.random() * 7 + 1));
        synth.setParameter("f_phs", Math.random() * M_PI);
        synth.setParameter("f_layer", (int) (Math.random() * 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", (int) (Math.random() * 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());
View Full Code Here

    }
  }

  public void gradientSaveBtn_clicked() {
    try {
      Layer layer = tinaController.getCurrLayer();
      if (layer != null) {
        JFileChooser chooser = new MapFileChooser(prefs);
        if (prefs.getTinaGradientPath() != null) {
          try {
            chooser.setCurrentDirectory(new File(prefs.getTinaGradientPath()));
          }
          catch (Exception ex) {
            ex.printStackTrace();
          }
        }
        if (chooser.showSaveDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
          File file = chooser.getSelectedFile();
          RGBPalette gradient = layer.getPalette().makeCopy();
          gradient.setFlam3Name(file.getName());
          new MapGradientWriter().writeGradient(gradient, file.getAbsolutePath());
          tinaController.showStatusMessage(gradient, "gradient saved to disc");
        }
      }
View Full Code Here

        sb.append("  flame.setPostSymmetryCentreY(" + Tools.doubleToString(pFlame.getPostSymmetryCentreY()) + ");\n");
        break;
    }

    for (int i = 0; i < pFlame.getLayers().size(); i++) {
      Layer layer = pFlame.getLayers().get(i);
      addLayer(sb, layer, i);
    }

    sb.append("  // Either update the currently selected flame (to not need to create a new thumbnail\n");
    sb.append("  // in the thumbnail ribbon after each run of the script...\n");
View Full Code Here

public class Spherical3DRandomFlameGenerator extends RandomFlameGenerator {

  @Override
  protected Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0.0);
    flame.setCentreY(-0.20);
    flame.setCamPitch(48.0);
    flame.setCamYaw(112.0);
    flame.setCamZoom(3.6);
    flame.setCamPerspective(0.32);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    flame.setPreserveZ(Math.random() < 0.5);

    boolean invert = Math.random() > 0.5;
    VariationFunc varFunc;

    // 1st xForm
    XForm xForm1;
    {
      XForm xForm = xForm1 = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(1.0 + 4.0 * Math.random());

      varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
      if (invert) {
        varFunc.setParameter("invert", 1);
      }
      xForm.addVariation(1.0, varFunc);
      XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
      XFormTransformService.globalTranslate(xForm, 1.0, 0.0, false);

      xForm.setColor(1.0);
      xForm.setColorSymmetry(0.9 + Math.random() * 0.1);
    }
    // 2nd xForm
    XForm xForm2;
    {
      XForm xForm = xForm2 = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 4.5);
      varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
      if (invert) {
        varFunc.setParameter("invert", 1);
      }
      xForm.addVariation(1.0, varFunc);
      XFormTransformService.rotate(xForm, 90.0, false);
      xForm.setColor(0.5);
      xForm.setColorSymmetry(0.9 + Math.random() * 0.1);
    }

    String cylinderVar = Math.random() < 0.5 ? "cylinder" : "cylinder_apo";

    // 3rd xForm
    String fncList[] = { "bipolar", "blade", "blur", "blur3D", "cannabiscurve_wf", "crackle", "cylinder", "cylinder_apo", "edisc", "flower", "glynnSim2",
        "julia3D", "mandelbrot", "modulus", "noise", "parabola", "pie", "pie3D", "checks", "pre_subflame_wf", "radial_blur", "rays",
        "rings", "rose_wf", "secant2", "sinusoidal", "spiral", "spirograph", "splits", "square", "twintrian", "wedge_julia" };
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5);
      xForm.addVariation(0.25 + 0.25 * Math.random(), VariationFuncList.getVariationFuncInstance("pre_blur", true));
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance("ztranslate", true));
      String fnc = Math.random() < 0.66 ? cylinderVar : fncList[(int) (Math.random() * fncList.length)];
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance(fnc, true));
      XFormTransformService.scale(xForm, 5.0, false, true, true);
      xForm.setColor(1.0);
      xForm.setColorSymmetry(-1.0);
    }

    // 4th xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5);
      xForm.addVariation(0.025 + 0.025 * Math.random(), VariationFuncList.getVariationFuncInstance("pre_blur", true));
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance("ztranslate", true));
      String fnc = Math.random() < 0.33 ? cylinderVar : fncList[(int) (Math.random() * fncList.length)];
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance(fnc, true));
      XFormTransformService.scale(xForm, 3.0, false, true, true);
      xForm.setColor(1.0);
      xForm.setColorSymmetry(-1.0);
    }

    // 5th xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.1);
      xForm.addVariation(0.005 + Math.random() * 0.005, VariationFuncList.getVariationFuncInstance("gaussian_blur", true));
      xForm.addVariation(0.005 + Math.random() * 0.005, VariationFuncList.getVariationFuncInstance("ztranslate", true));
      XFormTransformService.globalTranslate(xForm, 0.3, 0.0, true);
      xForm.setColor(1.0);
      xForm.setColorSymmetry(-1.0);
    }
    // 6th (final) xForm
    if (Math.random() < 0.5) {
      XForm xForm = new XForm();
      layer.getFinalXForms().add(xForm);
      xForm.setWeight(0.1);
      int power;
      int style = (int) (3 * Math.random());
      switch (style) {
        case 0:
View Full Code Here

TOP

Related Classes of org.jwildfire.create.tina.base.Layer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.