1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Paid Consulting Some help with Movie titles -

Posted by HG Lewes on Apr 19, 2007

Hi:

. I am a programmer, but new to Python...

. I need some help in using NodeBox to create
some nice clean simple titles for my short films.

i.e.
Black background, white letters, with slight reflection below...
other unique (but simple) title effects, outputting to QuickTime.
Similar to:
http://officeblogs.net/powerpoint/20060630/TitleSlideReflection.png



. I am will to pay for it - if anyone is interested, can you please
post a response


Thanks,

H.G.



Posted by Tom De Smedt on Apr 21, 2007

Hi H.G.,

Let me know if you find someone to help you out. Otherwise I'll show you some simple scripts to get you started.

Regards,
Tom



Posted by H.G. on Apr 22, 2007

Hey Tom,

Thanks!

If you could send me some samples, that would be great!
How can I contact you?
my email is
hglewes
AT
gmail.com



Posted by Tom De Smedt on May 10, 2007

Hi H.G.,

I whipped up an example for you.

It uses the Core Image library for blur and lighting effects, so you will have to download that.

On the downside, Core Image has some memory problems when you try to generate a Quicktime-movie directly from it. so we'll have to do it in two steps: first create a range of PDF frames, then collect all the frames in a second NodeBox script and make a movie out of that.

You may want to have Activity Monitor open so you can check when NodeBox + Core Image is using up too much memory. Then simply restart NodeBox.

The script to render separate PDF's from:

size(500, 400)
 
# How many frames will we render?
duration = 100
 
# We're going to need the coreimage library.
coreimage = ximport("coreimage")
 
# Create a pixel canvas.
canvas = coreimage.canvas(WIDTH, HEIGHT)
 
# Background gradient layer.
canvas.layer_fill(coreimage.color(0.0, 0.0, 0.0))
l = canvas.layer_linear_gradient(coreimage.color(1.0, 0.9, 0.9))
l.flip_vertical()
l.scale(1.5, 0.4)
l.translate(0.5, 0.85)
l.blend(0.4)
l.filter_blur(20)
 
# Smooth fading with a sine function.
# The fade level depends on the current page we are rendering.
from math import sin, pi
frame = PAGENUM-1
fade = sin(pi*frame/duration)
 
# Some text to display.
txt = textpath("MOVIE CREDITS", 0, 0)
 
# White text with effects.
# A blur depending on the fade level...
# Some lighting brushing across the text...
# Some scaling as the animation progresses...
coreimage.PATH_PADDING = 10
l = canvas.layer_path(txt, foreground=color(1))
l.origin_top_left()
l.x = 30
l.y = 250
l.blend(fade)
l.filter_blur(2*(1-fade))
l.filter_lighting(dx1=frame/2)
l.scale(0.9+frame*0.001)
 
# To reflect the text,
# we duplicate the layer, flip it,
# and mask it with a linear gradient.
reflection = l.duplicate()
m = reflection.mask.layer_linear_gradient()
m.flip_vertical()
reflection.flip_vertical()
reflection.y = 250 + fontsize()
reflection.blend(fade*0.25)
 
canvas.draw()
You can adjust the duration to the amount of frames to render. From the NodeBox File menu, Export as PDF and enter the number of pages (say, a hundred). Once you have separate PDF frames you can collect them with this piece of code:
size(500, 400)
frames = files("*.pdf")
image(frames[FRAME-1], 0, 0)
From the File menu, Export as Quicktime Movie and set a number of frames (the same amount as the duration and the number of separate PDF's). You should end up with a .mov of the animation.



Posted by H. G. Lewes on Jul 28, 2007

Thanks a million Tom! It works amazingly well!
Sorry for delay in getting back, I didn't see your reply.

That is JUST what I needed to get started. Python is GREAT.

I want t make this interactive, and I can do everything I want EXCEPT for the button

---------------------
Quick Question:
(From Reference)
The command parameter for buttons is the name of a
command in your script to call when the button is
pressed.

. What is meant by "a command" in your script

I have tried calling a function
with this:

var("hello()", BUTTON)
 
def hello():
    print "Hello World"
but I just get errors when I press the button, no matter what I try.

Any help would be greatly appreciated, I fear there is an obvious answer I am missing ;)

H. G.