character

Basil.js, repeat, typography
Fabian Morón Zirfas
one single character repeated several times.
#includepath "~/Documents/;%USERPROFILE%Documents"; // eslint-disable-line
#include "basiljs/bundle/basil.js";// eslint-disable-line
// simple sketch showing the usage of some primitive forms

var pw = 200;
var ph = 200;
var top = 20;
var right = 20;
var bottom = 30;
var left  = 20;
function draw(){
  b.clear(b.doc()); // clear the current document
  b.units(b.MM); // we want to print. use MM intead of default pixels

  var doc = b.doc(); // a reference to the current document
  // set some preferneces of the document for better handling
  doc.documentPreferences.properties = {pageWidth:pw,pageHeight:ph};
  doc.viewPreferences.rulerOrigin = RulerOrigin.SPREAD_ORIGIN;
  // ----------
  // main code goes here
  b.margins(top, right, bottom, left);
  b.textSize(144*2);
  b.textAlign(Justification.CENTER_JUSTIFIED , VerticalJustification.CENTER_ALIGN );
  var textFrame = b.text('a',top,left,b.width - (right + left),b.height - (bottom + top));
  var chr = textFrame.characters[0];
  chr.fillTint = 5;
  chr.strokeColor = doc.swatches[3];
  chr.strokeTint = 50;
  textFrame.transparencySettings.blendingSettings.opacity = 10;
  textFrame.transparencySettings.blendingSettings.blendMode = BlendMode.MULTIPLY;
  textFrame.transparencySettings.featherSettings.mode = FeatherMode.STANDARD; // <-- We need this to activate the feather
  textFrame.transparencySettings.featherSettings.chokeAmount = 10;
  textFrame.transparencySettings.featherSettings.cornerType = FeatherCornerType.DIFFUSION;
  for(var i = 0; i < 100;i++){
    textFrame.duplicate(undefined, [b.random(-5,5),b.random(-5,5)]);
  }

  // ----------
  var fname = File($.fileName).parent.fsName + '/' + ($.fileName.split('/')[$.fileName.split('/').length - 1]).split('.')[0] + '.indd';
 // b.println(fname);
  doc.save(fname, false, 'basil', true);
  b.savePNG('out.png');
}

b.go();