Advertisement
LKSmith

JWF - Script/ LKS-41 (Spirals)

Jun 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 KB | None | 0 0
  1. import org.jwildfire.create.tina.base.Flame;
  2. import org.jwildfire.create.tina.base.XForm;
  3. import org.jwildfire.create.tina.palette.RGBPalette;
  4. import org.jwildfire.create.tina.script.ScriptRunnerEnvironment;
  5. import org.jwildfire.create.tina.transform.XFormTransformService;
  6. import org.jwildfire.create.tina.variation.VariationFunc;
  7. import org.jwildfire.create.tina.variation.VariationFuncList;
  8. import org.jwildfire.create.tina.mutagen.RandomGradientMutation;
  9. import org.jwildfire.create.tina.transform.XFormTransformService;
  10.  
  11. public void run(ScriptRunnerEnvironment pEnv) throws Exception {
  12. // create a new flame
  13. Flame flame=new Flame(); // set the flame main attributes
  14. flame.setCamRoll(0);
  15. flame.setCamPitch(40);
  16. flame.setCamYaw(0);
  17. flame.setCamPerspective(0.2);
  18. flame.setWidth(860);
  19. flame.setHeight(484);
  20. flame.setPixelsPerUnit(179.28);
  21. flame.setCamZoom(2);
  22. flame.setBGTransparency(false);
  23. flame.setBrightness(2.54);
  24. flame.setContrast(.1);
  25. flame.setGamma(2.5);
  26. flame.setCentreX(0);
  27. flame.setCentreY(.265);
  28. // create transform 1
  29. {
  30. XForm xForm = new XForm();
  31. flame.getXForms().add(xForm);
  32. xForm.setWeight(941.69);
  33. xForm.setColor(0.74899);
  34. xForm.setColorSymmetry(0.9);
  35.  
  36. xForm.setCoeff00(-0.00914495); // a
  37. xForm.setCoeff10(0.94047); // b
  38. xForm.setCoeff20(-0.53721); // e
  39. xForm.setCoeff01(-0.94047); // c
  40. xForm.setCoeff11(-0.00914495); // d
  41. xForm.setCoeff21(0.15805); // f
  42.  
  43. xForm.setPostCoeff00(1);
  44. xForm.setPostCoeff10(0);
  45. xForm.setPostCoeff01(0);
  46. xForm.setPostCoeff11(1);
  47. xForm.setPostCoeff20(0);
  48. xForm.setPostCoeff21(0);
  49.  
  50. // variation 1
  51. {
  52. VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("fan2", true);
  53. varFunc.setParameter("x", 0.53076);
  54. varFunc.setParameter("y", -9.41);
  55. xForm.addVariation(1, varFunc);
  56. }
  57. // variation 2
  58. {
  59. VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("post_spin_z", true);
  60. // varFunc.setParameter("power", 1);
  61. xForm.addVariation(Math.random()*-2, varFunc);
  62. }
  63. // random affine transforms (uncomment to play around)
  64. // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
  65. // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
  66. // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
  67. // random affine post transforms (uncomment to play around)
  68. // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
  69. // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
  70. // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
  71. }
  72. // create transform 2
  73. {
  74. XForm xForm = new XForm();
  75. flame.getXForms().add(xForm);
  76. xForm.setWeight(60.92);
  77. xForm.setColor(0.09527);
  78. xForm.setColorSymmetry(-1);
  79.  
  80. xForm.setCoeff00(0.0044065); // a
  81. xForm.setCoeff10(0.49809); // b
  82. xForm.setCoeff20(0.10451); // e
  83. xForm.setCoeff01(-0.49809); // c
  84. xForm.setCoeff11(0.0044065); // d
  85. xForm.setCoeff21(0.46561); // f
  86.  
  87. xForm.setPostCoeff00(1);
  88. xForm.setPostCoeff10(0);
  89. xForm.setPostCoeff01(0);
  90. xForm.setPostCoeff11(1);
  91. xForm.setPostCoeff20(0);
  92. xForm.setPostCoeff21(0);
  93.  
  94. // variation 1
  95. {
  96. VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("julia3D", true);
  97. varFunc.setParameter("power", 160);
  98. xForm.addVariation(1, varFunc);
  99. }
  100. // variation 2
  101. {
  102. VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("epispiral", true);
  103. varFunc.setParameter("n", 4);
  104. varFunc.setParameter("thickness", 0);
  105. varFunc.setParameter("holes", 0);
  106. xForm.addVariation(0.0085, varFunc);
  107. }
  108. // variation 3
  109. {
  110. VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("post_depth", true);
  111. varFunc.setParameter("power", 1);
  112. xForm.addVariation(-0.9, varFunc);
  113. }
  114. // random affine transforms (uncomment to play around)
  115. // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
  116. // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
  117. // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
  118. // random affine post transforms (uncomment to play around)
  119. // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
  120. // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
  121. // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
  122. }
  123. // create a random gradient
  124. new RandomGradientMutation().execute(flame);
  125. // Either update the currently selected flame (to not need to create a new thumbnail
  126. // in the thumbnail ribbon after each run of the script...
  127. Flame selFlame = pEnv.getCurrFlame();
  128. if(selFlame!=null) {
  129. selFlame.assign(flame);
  130. pEnv.refreshUI();
  131. }
  132. // ...or load the flame in the editor and refresh the UI
  133. else {
  134. pEnv.setCurrFlame(flame);
  135. }
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement