Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.jwildfire.create.tina.base.Flame;
- import org.jwildfire.create.tina.base.XForm;
- import org.jwildfire.create.tina.palette.RGBPalette;
- import org.jwildfire.create.tina.script.ScriptRunnerEnvironment;
- import org.jwildfire.create.tina.transform.XFormTransformService;
- import org.jwildfire.create.tina.variation.VariationFunc;
- import org.jwildfire.create.tina.variation.VariationFuncList;
- import org.jwildfire.create.tina.mutagen.RandomGradientMutation;
- import org.jwildfire.create.tina.transform.XFormTransformService;
- public void run(ScriptRunnerEnvironment pEnv) throws Exception {
- // create a new flame
- Flame flame=new Flame(); // set the flame main attributes
- flame.setCamRoll(0);
- flame.setCamPitch(40);
- flame.setCamYaw(0);
- flame.setCamPerspective(0.2);
- flame.setWidth(860);
- flame.setHeight(484);
- flame.setPixelsPerUnit(179.28);
- flame.setCamZoom(2);
- flame.setBGTransparency(false);
- flame.setBrightness(2.54);
- flame.setContrast(.1);
- flame.setGamma(2.5);
- flame.setCentreX(0);
- flame.setCentreY(.265);
- // create transform 1
- {
- XForm xForm = new XForm();
- flame.getXForms().add(xForm);
- xForm.setWeight(941.69);
- xForm.setColor(0.74899);
- xForm.setColorSymmetry(0.9);
- xForm.setCoeff00(-0.00914495); // a
- xForm.setCoeff10(0.94047); // b
- xForm.setCoeff20(-0.53721); // e
- xForm.setCoeff01(-0.94047); // c
- xForm.setCoeff11(-0.00914495); // d
- xForm.setCoeff21(0.15805); // f
- xForm.setPostCoeff00(1);
- xForm.setPostCoeff10(0);
- xForm.setPostCoeff01(0);
- xForm.setPostCoeff11(1);
- xForm.setPostCoeff20(0);
- xForm.setPostCoeff21(0);
- // variation 1
- {
- VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("fan2", true);
- varFunc.setParameter("x", 0.53076);
- varFunc.setParameter("y", -9.41);
- xForm.addVariation(1, varFunc);
- }
- // variation 2
- {
- VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("post_spin_z", true);
- // varFunc.setParameter("power", 1);
- xForm.addVariation(Math.random()*-2, varFunc);
- }
- // random affine transforms (uncomment to play around)
- // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
- // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
- // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
- // random affine post transforms (uncomment to play around)
- // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
- // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
- // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
- }
- // create transform 2
- {
- XForm xForm = new XForm();
- flame.getXForms().add(xForm);
- xForm.setWeight(60.92);
- xForm.setColor(0.09527);
- xForm.setColorSymmetry(-1);
- xForm.setCoeff00(0.0044065); // a
- xForm.setCoeff10(0.49809); // b
- xForm.setCoeff20(0.10451); // e
- xForm.setCoeff01(-0.49809); // c
- xForm.setCoeff11(0.0044065); // d
- xForm.setCoeff21(0.46561); // f
- xForm.setPostCoeff00(1);
- xForm.setPostCoeff10(0);
- xForm.setPostCoeff01(0);
- xForm.setPostCoeff11(1);
- xForm.setPostCoeff20(0);
- xForm.setPostCoeff21(0);
- // variation 1
- {
- VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("julia3D", true);
- varFunc.setParameter("power", 160);
- xForm.addVariation(1, varFunc);
- }
- // variation 2
- {
- VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("epispiral", true);
- varFunc.setParameter("n", 4);
- varFunc.setParameter("thickness", 0);
- varFunc.setParameter("holes", 0);
- xForm.addVariation(0.0085, varFunc);
- }
- // variation 3
- {
- VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("post_depth", true);
- varFunc.setParameter("power", 1);
- xForm.addVariation(-0.9, varFunc);
- }
- // random affine transforms (uncomment to play around)
- // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
- // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
- // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
- // random affine post transforms (uncomment to play around)
- // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
- // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
- // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
- }
- // create a random gradient
- new RandomGradientMutation().execute(flame);
- // Either update the currently selected flame (to not need to create a new thumbnail
- // in the thumbnail ribbon after each run of the script...
- Flame selFlame = pEnv.getCurrFlame();
- if(selFlame!=null) {
- selFlame.assign(flame);
- pEnv.refreshUI();
- }
- // ...or load the flame in the editor and refresh the UI
- else {
- pEnv.setCurrFlame(flame);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement