![]() The first rectangle's width is 100, then the value of the variable changes to 20, so the two following rectangles use that new value and have width 20. When this happens, the old value is thrown away, and from now on the variable contains the new value. You can change the value of a variable during the course of a script. In this example, a rectangle is drawn at (10,10), with width of 100 and height of 30. width = 100 rect ( 10, 10, width, 30 ) Variables can be used as parameters. NodeBox keeps a small sticky note reminder for itself to know what value is inside the variable. It's as easy as this: we think of a good name for a variable, and assign any value to it we like. No one likes to type theWidthOfAllRectangles an dozen times, width says enough. Usually, you pick a name that tells something about what kind of information the variable is storing. You can declare a variable at any point in your script, and give it any name you like, except for names that NodeBox has already claimed (like rect, or for). This way, when you change your mind about the rectangle's width, you only need to change the contents of the width variable, since each rectangle is looking over there for it's width.ĭon't worry, things will clear up once we try some examples! Declaring variables If each of ten rectangles you're going to draw is a hundred pixels wide, it's a good idea to declare a width variable that stores the number 100, and tell each rectangle to go look what's inside this width variable. You store things in variables when you plan to reuse them. Just like boxes, variables can hold all sorts of stuff useful in a NodeBox script: pieces of text, an important number, the name of a font, a list of colors, and so on.Īnother way to look at variables is to think of them as a sticky note. The name is like the label on a box: it's a quick reminder of what item, or value, is inside the variable. Usually, people put labels or some kind of code on boxes to remember what is inside. ![]() You can put something inside the box, put it away for storage, and later on retrieve the item from the box. You could think of a variable as a cardboard box. The site also has a forum where users can post questions, and a gallery showcasing the latest work.A variable is a place to store a value in computer memory. NodeBox has a lot of documentation: both a tutorial explaining the basics of programming graphics and a reference for each command in the application. The most notable ones are the SVG library for importing SVG paths, the bezier editor for drawing right inside of the application, and Core Image for doing Photoshop-like image manipulations (layers with blending modes, color changes, filters) using the OS X Core Image library, which is hardware accelerated. ![]() NodeBox has a large set of external libraries, all available on the library page. NodeBox is built using PyObjC, and using the Cocoa rendering engine (Quartz), which natively supports PDF. You can apply all these transformations to text as well. You can specify fill and stroke colors using RGB, HSB or CMYK, all with alpha transparency.īezier path have methods for deconstructing them into contours, inserting points at arbitrary positions on the path, and constructing paths based on a list of points. It supports images (even PDF) and text (with line wrapping). NodeBox supports simple forms such as rectangles, ovals, stars, and arrows, but also bezier paths in general. NodeBox is a Mac OS X application that lets you create 2D visuals (static, animated or interactive) using Python and export them as a PDF or QuickTime movie.
0 Comments
Leave a Reply. |