fabianmoronzirfas
4/13/2016 - 8:44 AM

drehwurm.jsx

    #includepath "~/Documents/;%USERPROFILE%Documents"; // eslint-disable-line
    #include "basiljs/bundle/basil.js";
    function draw() {
      b.clear(b.doc()); // clear the current document
      b.units(b.MM); // we want to print. use MM intead of default pixels
      b.rectMode(b.CENTER); // draw rects from the center
      b.ellipseMode(b.CENTER); // draw ellipses from the center
      var doc = b.doc(); // a reference to the current document
      // set some preferneces of the document for better handling
      var rand = b.random(30, 255);
      doc.documentPreferences.properties = {
        pageWidth: 200,
        pageHeight: 200
      };
      doc.viewPreferences.rulerOrigin = RulerOrigin.SPREAD_ORIGIN;
      b.noStroke();
      b.fill((255), (255), (255));
      //~       var rec = b.rect ((b.width/2), (b.height/2);(b.width-  4*w), (b.height-4*w)); <- wieso kann man so etwas nicht schreiben (mit w drin)
      for (var w = 2; w < 40; w++) {
        b.rotate(10);
        b.scale(0.9);
        //~            b.rotate(10);
        //~        b.fill((255),b.random (230), (255));
        //~    b.rect ((b.width/2), (b.height/2),b.width-4*w, b.height-4*w,); andere Variante
        if (w % 2 == 1) {
          b.fill((80), (160), (255));
        } else {
          b.fill((255), (255), (255));
        }
        var rectWithShadow = b.rect((b.width / 2), (b.height / 2), (b.width * 1.5), (b.height * 1.5));
        rectWithShadow.transparencySettings.blendingSettings.opacity = (100 - w * 2)
      }
    }
    b.go();