New tool - spiral

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
myles
Posts: 821
Joined: Sat Aug 21, 2004 3:32 am
Location: Australia, Victoria, Morwell
Contact:

New tool - spiral

Post by myles »

Greetings all,

as an exercise in scripting, I've written a simple spiral tool. :D
Note: not a menu script. 8)

Warning: while this works on the few tests I've done, it is not thoroughly tested or reviewed yet. Try it at your own risk :twisted:
You may wish to back up your existing _tool_list.txt file before trying this.

The files are available at :
http://www-personal.monash.edu.au/~myle ... index.html

Right-click and save all three files to your tool folder under scripts. Note: you can manually edit _tool_list.txt if you prefer.

Note for Mac users: You may possibly have to convert the line endings in the .lua and .txt files - or maybe not. Sorry, I don't have access to a Mac to test this. :oops:

Regards, Myles.
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Nice! Mac users - you don't have to do anything funny with line endings. Lua scripts should run un-modified on Windows and Mac.
User avatar
tknaps
Posts: 27
Joined: Fri Aug 06, 2004 2:31 pm
Location: Trondheim, Norway

Post by tknaps »

Damn you Myles! Just what I was planning to do this weekend! :)

Guess I'll have to think of something else then, or maybe peer-review/bugfix/improve yours :)

I've made a lame script for creating a parallelogram (or rhombus if you like), but there's a few hitches I need to fix before making it available somewhere. Also just an excercise, so I don't know if it's useful for anyone :)

Cheers,
Tarjei
myles
Posts: 821
Joined: Sat Aug 21, 2004 3:32 am
Location: Australia, Victoria, Morwell
Contact:

Post by myles »

Hi Tarjei!
tknaps wrote:Damn you Myles! Just what I was planning to do this weekend! :)
Heh! :twisted:

It might still be worth doing, just for the Lua learning involved :wink:
tknaps wrote:Guess I'll have to think of something else then, or maybe peer-review/bugfix/improve yours :)
Feel free to do all of the above - maybe a version that scales differently with the mouse movement in X and Y directions (an oval/ellipse spiral ?), controlled with an option check-box at the top of the workspace ?
tknaps wrote:I've made a lame script for creating a parallelogram (or rhombus if you like), but there's a few hitches I need to fix before making it available somewhere. Also just an excercise, so I don't know if it's useful for anyone :)
Post it when it's finished! The more working scripts, the better - both as tools and to help understand scripting.

Regards, Myles.
User avatar
tknaps
Posts: 27
Joined: Fri Aug 06, 2004 2:31 pm
Location: Trondheim, Norway

Post by tknaps »

Hi Myles!
myles wrote:It might still be worth doing, just for the Lua learning involved :wink:
Yes, I know, but it's a lot more fun to do something new :)
tknaps wrote:Guess I'll have to think of something else then, or maybe peer-review/bugfix/improve yours :)
myles wrote:Feel free to do all of the above - maybe a version that scales differently with the mouse movement in X and Y directions (an oval/ellipse spiral ?), controlled with an option check-box at the top of the workspace ?
Yes, that's an idea. Shouldn't be too much of a hassle (I'm sure you're going to run off and implement his yourself now! :D)

I also thought of a checkbox for automatically animating the spiral layer to make classic "psychedelic spiral" animations, and maybe also adding noise to it. Will need to stare a bit more at the API first though, I wish we had function arguments listed... (hint, hint LM! ;))
tknaps wrote:I've made a lame script for creating a parallelogram (or rhombus if you like), but there's a few hitches I need to fix before making it available somewhere. Also just an excercise, so I don't know if it's useful for anyone :)
myles wrote:Post it when it's finished! The more working scripts, the better - both as tools and to help understand scripting.
Indeed, will do. I'll set up anonymous ftp or something from my home machine which is (mostly) up 24/7, at least until we hopefully can get a common script repository set up.

Cheers,
Tarjei
myles
Posts: 821
Joined: Sat Aug 21, 2004 3:32 am
Location: Australia, Victoria, Morwell
Contact:

Post by myles »

tknaps wrote:
myles wrote:Feel free to do all of the above - maybe a version that scales differently with the mouse movement in X and Y directions (an oval/ellipse spiral ?), controlled with an option check-box at the top of the workspace ?
Yes, that's an idea. Shouldn't be too much of a hassle (I'm sure you're going to run off and implement his yourself now! :D)
Nah, I'm too lazy, I just realised I can always scale the points after the spiral is drawn. :)
tknaps wrote:I also thought of a checkbox for automatically animating the spiral layer to make classic "psychedelic spiral" animations, and maybe also adding noise to it. Will need to stare a bit more at the API first though, I wish we had function arguments listed... (hint, hint LM! ;))
Just guessing without looking at it, but you might be able to extract the details and guess the arguments for much of this from the Rotate tool code.

Hmm, you can always animate the rotation later, using the normal tools.

A better project might be to make a multi-arm spiral - so you can have multi-coloured fills - maybe a text-box for choosing the number of arms ?
Maybe auto-weld the center points, and create and weld a multi-point circle around the outer points ?

Now that is a tool I could use - if you don't feel like trying that or don't get a chance in the next couple of weeks, I'll try implementing that one.

Regards, Myles - spiralling downward into madness.
Post Reply