Move_to Node
This happens often: I have a shape, not centered on the origin, and I want to move it to a particular location.
To do this very simple thing I have to:
- find the centroid of the shape
- calculate the relative position change. The easiest way to do this is:
- open Cartan Node Library
- copy my rel_change node
- paste it back in my project
- add a translate node and translate the shape using the output of rel_change
When this happened for the twelve hundredth time I finally decided just to make a new node to do this in one fell swoop. Saves time and also results in cleaner code.
move_to will appear in the next release of the Cartan Node Library. But if you need to move a shape now, you can copy it from the attached demo.
Enjoy!
John
- move_to_screenshot.png 387 KB
- move_to_node.zip 3.6 KB
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by john on Jul 03, 2022 @ 11:08 PM
Well, this is embarrassing.
After ALL these years using Nodebox almost every day, and after using the align node in almost every network I make, I somehow never noticed that align already does everything my move_to node does and more!
I always thought of align as a tool for centering things or left-justifying them or whatever. In my mind moving a single shape to a new location was a totally different function. I simply ignored the position port of the align node and always left it set to the origin.
But of course it you put a different value there it will move the shape to that position. Even better you can center on that position, or align the top left or whatever. Nice.
So there is simply no need for a move_to node. I will therefor deprecate it and remove it from version 3.1 of my library.
It's strange how the human mind works. In retrospect it seems bizarre that I never noticed this before. My arbitrary mental categories created a blind spot.
Of course it doesn't help that there is so little documentation about each node. I have sometimes been tempted to write a book with a short chapter on each node, exploring it in depth, showing how its used, and coming up with a whimsical demo for each one. But it would take me a year to write such a book and it would probably have an audience of a only a few dozen hangers on.
So much to do, so little time.
John