Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Solved
    • Unsolved
    • Search
    1. Home
    2. frederik
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Frederik Berlaen

    @frederik

    admin

    78
    Reputation
    269
    Posts
    1134
    Profile views
    5
    Followers
    1
    Following
    Joined Last Online
    Website www.typemytype.com Age 41

    frederik Follow
    drafts admin

    Best posts made by frederik

    • DrawBot 3.112 Release

      A new version is available:

      • The launch time is now at lightning speed!

      • Added a new keyword argument center for the rotate(), scale(), and skew() functions.

      The optional center argument will make the transformation be centered around the given point:

      rotate(20, center=(500, 500)) # rotate around (500, 500)
      rect(250, 250, 500, 500)
      

      Just for reference: the extra argument does the same as this example but is a lot more convenient:

      # define a center point
      centerX, centerY = 500, 500
      # translate to that center point
      translate(centerX, centerY)
      # do the transformation
      rotate(20)
      # translate back 
      translate(-centerX, -centerY)
      # draw something
      rect(250, 250, 500, 500)
      

      Download and Play!!!

      posted in Announcements
      frederik
      frederik
    • RE: Generate animated .gifs, .pdfs similar to generateMP4()?

      that is possible you can use:

      from drawBot.context.tools.gifTools import generateGif
      
      generateGif(gifPaths, destinationPath, frameRates)
      # gifPaths: a list of paths to gif files
      # destinationPath: a path where to save the animated gif
      # frameRates: a list with the same length as the gifPaths of ints in 1/100sec
      

      see https://github.com/typemytype/drawbot/blob/master/drawBot/context/tools/gifTools.py#L11

      hope this works!

      posted in General Discussion
      frederik
      frederik
    • DrawBot 3.122 is released
      • Adding bezierPath.expandStroke(width, lineCap="round", lineJoin="round", miterLimit=10) (thanks to Bahman Eslami)

      • Improved internal OpenType feature tags setting

      • Improved complex formattedString type setting

      • Improved alignment with text() and FormattedString

      • Added a DrawBot frontend for pip/PyPI to make it super easy to install third-party packages: see menu Python -> Install Python Packages...

        DrawBotPipDemo.gif

      • Fixed text stroke behavior (but is a breaking change): strokeWidth on text no longer scales with the fontSize

      • Removed support for .mov export on 10.15 and up (QTKit is no longer supported there)

      • Fixed extracting single frames from .gif files

      • Improved setup.py, so drawbot-as-a-module can be easily installed with pip using a github URL

      • All test now run on Travis CI (and soon also on GitHub Actions)

      • Removed Python 2 code

      • Many small issues were fixed

      posted in Announcements
      frederik
      frederik
    • DrawBot3.121 is released
      • Jumping to python 3.7

        If you use external packages you will need to install them for python 3.7. If you don't have python 3.7 installed you will need to do that first.

      • Improved syntax highlighting for python 3

      • Fallback fonts are also used in a svg context.

      • listNamedInstances() lists all named instances for a variable font.

      • BezierPath objects have bezierPath.line(pt1, pt2) and bezierPath.polygon(pt1, pt2, ...) methods.

      • Update internal packages!

      posted in Announcements
      frederik
      frederik
    • RE: Are there any tutorials on how to build Drawbot python files via Sublime?

      you could save the result to disk and open the result in an specified app with:

      from drawBot import *
      
      fill(random(), random(), random())
      rect(10, 10, 100, 100)
      
      path = "~/Desktop/test.pdf"
      saveImage("~/Desktop/test.pdf")
      
      import os
      os.system(f"open --background -a Preview {path}")
      
      posted in General Discussion
      frederik
      frederik
    • RE: arcTo documentation?

      I understand the confusion 🙂

      a much better explanation:

      The created arc is defined by a circle inscribed inside the angle specified by three points: the current point, the fromPoint parameter, and the toPoint parameter (in that order). The arc itself lies on the perimeter of the circle, whose radius is specified by the radius parameter. The arc is drawn between the two points of the circle that are tangent to the two legs of the angle.
      The arc usually does not contain the points in the fromPoint and toPoint parameters. If the starting point of the arc does not coincide with the current point, a line is drawn between the two points. The starting point of the arc lies on the line defined by the current point and the fromPoint parameter.

      https://developer.apple.com/documentation/appkit/nsbezierpath/1520737-appendbezierpathwitharcfrompoint

      I will adjust the drawBot documentation

      posted in General Discussion
      frederik
      frederik
    • RE: while()

      This is savedState() http://www.drawbot.com/content/canvas/state.html#drawBot.savedState

      with savedState():
          # do something
      

      This is more readable and clearer then wrapping code inside a save / restore statement.

      posted in General Discussion
      frederik
      frederik
    • RE: What's the main difference between py2 vs py3?

      For beginners there is not such a big difference:

      Strings

      All strings are unicode string, so no converting back and forth, but this is actually the best thing!!

      print

      print('hello world') requires brackets ( and )

      divisions

      Divisions are always floats so no more rounding, this is also a good thing: 1/3-> 0.333333 instead of 0

      You keep the old behaviour with 1//3

      If you dive deeper:

      dictionaries

      dict.keys(), dict.values(), dict.items() are not a lists anymore

      Looping (a for loop or a while loop) over a dictionary and changing content of that dictionary is tricky:

      for key in list(myDict.keys()):
          myDict[key] = "changed" + myDict[key]
      

      There is of course more

      • Python2 or Python3
      • What's New
      • google it 🙂
      posted in General Discussion
      frederik
      frederik
    • RE: Stephen Nixon's blogified class notes: a useful beginners' DrawBot tutorial

      @thundernixon ssssht py3.6 🙂

      posted in Tutorials
      frederik
      frederik
    • RE: Impossible typefaces?

      there are plainly of references in generative art, going from artist like Sol Lewit to graphic designers Juriaan Schrofer and many more.

      good luck!!

      posted in Code snippets
      frederik
      frederik

    Latest posts made by frederik

    • RE: when to apply paragraphBottomSpacing

      I guess this is a coreText thing. When composing the same text with hard returns and soft returns (shift + enter) in TextEdit, there is no difference between soft and hard returns.

      97bc7514-5ad3-49a9-a954-a2362b5dd714-image.png

      I guess you'll need to script it and change the the bottom spacing for text-runs with soft returns.

      posted in Feature Requests
      frederik
      frederik
    • RE: listNamedInstances is broken ?

      thanks for the issue

      --> https://github.com/typemytype/drawbot/issues/495

      posted in General Discussion
      frederik
      frederik
    • RE: listNamedInstances is broken ?

      can you provide the not working google fonts?

      and if this is persisting, it would be handy to open an issue in the drawBot repo.

      thanks!

      posted in General Discussion
      frederik
      frederik
    • RE: Running Drawbot as a module in environments that aren't Mac OS X

      DrawBot is mac only... that will not change fast as we got now a super high level of typographic support...

      However Just started drawBotSkia which has a subset of the DrawBot api but uses skia as backend.

      see https://github.com/justvanrossum/drawbot-skia

      posted in Bugs
      frederik
      frederik
    • RE: Mute DrawBot warning ?

      you can always ignore all warnings with:

      import warnings
      warnings.simplefilter("ignore")
      

      see https://docs.python.org/3.7/library/warnings.html

      posted in General Discussion
      frederik
      frederik
    • RE: Mute DrawBot warning ?

      which warning?

      posted in General Discussion
      frederik
      frederik
    • RE: BezierPath offset problem.

      the mistake here is that bounds are not structured as x, y, width, height as required for rect(...)but as minx, miny, maxx, maxy.

      minx, miny, maxx, maxy = path.bounds()
      rect(minx, miny, maxx-minx, maxy-miny)
      
      posted in General Discussion
      frederik
      frederik
    • RE: Python Update ?

      no, you can not.. but DrawBot exists also as a module where you can use your own python.

      see https://github.com/typemytype/drawbot#using-drawbot-as-a-python-module

      posted in General Discussion
      frederik
      frederik
    • RE: Beginner Question

      its all the same and very much based on coding flavours

      different approach, similar result, here you know the amount of lines exactly.

      import random
      
      size(600, 849)
      
      margin = 106
      density = [3,2,7,20, 1002] # the amount of lines
      rows = len(density)
      row_width = width() - 2 * margin
      row_height = (height() - 2 * margin) / rows
      
      fill(None)
      strokeWidth(1)
      stroke(0)
      
      for i, d in enumerate(density):
          y1 = margin + i * row_height
          y2 = y1 + row_height
          x_positions = [random.random() * row_width for _ in range(d)]
          for x in x_positions:
              line((x, y1),(x, y2))
      
      posted in General Discussion
      frederik
      frederik
    • RE: Beginner Question

      thanks @monomonnik! very well explained!

      the while loop at the end makes its maybe a bit unreadable...

      you can use random.sample to generate a random list easily:

      import random
      
      density = 5
      result = random.sample(range(0, 100), density)
      print(result)
      
      posted in General Discussion
      frederik
      frederik