Javascript programming resources

steve holmes's picture

Hi everyone I am wondering what resources people would recommend for learning Javascript in quartz composer. I have no experience in programming of any sort but would like to learn. I don't seem to have been able to find many tutorials. Is the javascript used in quartz composer similar to java in general and would I be better of learning java. Any advice you can give would be great. Cheers Steve

cwright's picture
notes

http://quartzcompositions.com has some nice tutorials for Quartz Composer and Javascript.

Don't learn Java -- JavaScript is Not Java. Not related, hardly similar, and learning java will not help much with doing stuff in JS.

gtoledo3's picture
I know this has been asked

I know this has been asked (by me and others!)...

If you type in "quartz composer developer javascript" on google, this is the third entry (I post it not because of it being pertinent to the discussion, but because it is HILARIOUS!!!!) http://importantshock.wordpress.com/2007/02/15/quartz-confuser/ I've seen this a few times, and chuckle every time.

My recourse has been to go into the developer folder, start looking at every example qtz., and examine the javascript patches inside. There are many great examples in "Conceptual" and in "Interactive"... and probably in some of the other folders as well.

I don't think that the QC Developer site has anything worthwhile about javascript in QC, but I might be wrong... I'm looking...

EDIT: It is so easy to forget quartzcompositions.com because it is dead activity-wise, but there are many extremely useful macros there. That is a great resource for learning quartz composer (someone needs to save that website to disk in case it goes defunct...though there is some "program" that consistently rips off just about every composition on the site with each new release so I guess the comps will always be around... can't remember the name).

kristopf's picture
One of the reasons...

One of the reasons there's very little info on JavaScript in QuartzComposer is that there is very little that is SPECIFIC to Quartz Composer.

Besides requireing that you declare the type of your input and output variables there are no changes to JavaScript - Besides the Log() function, QC doesn't add any functions or any datatypes to JavaScript.

While it might seem limiting to only be able to store a little data, do some math on a few numbers or manipulate strings and structures, that's pretty much all programming is.

I've been writing TONS of javascript in Quartz Composer lately, so if there are any specific questions you have - shoot.

cwright's picture
elegant

I think that's one of the most succinct explanations on the lack of documentation on QC-JS ever. Perfect!

gtoledo3's picture
kristopf, you are "the man",

kristopf, you are "the man", and that javascript workaround for the openCV patch was a heck of an eye opener.

yanomano's picture
Javascript good book

Hi Steve, You can also find a lot of code exemples here in kineme's forums: Do a search with (for exemple) this query : " return result; "

There is a good book : Object.oriented.javascript writted by Stoyan Stefanov (Packt publishing) For me this is a good book for JS in QC because it just start to speak about javascript inside a broswer environmment from the hundred sixty tenth page, so no HTML code to disrupt your learning...

dust's picture
lol-quartz confuser -javascript

that guy's funny. quartz confuser...i wonder if he actually took anytime to explore. he says the rss feed is the most complicated thing in qc but he can't turn off an interpolate. he must have some old version i have never seen, i know quartz is limited to safari for web stuff, but with the mysql plugs, xml reading, java script, etc it can make some damn cool web sites, to bad i upgraded to safari 4.0 ;(

i think apples decision to use java script was a good one and was maybe predicated upon its popularity or the looseness of the language like not having to define data types likes quartz "virtual" but thats only my guess. maybe its for the familiarity of the syntax. i personally know some things can be done easier faster with java script but i find it a challenge to not use java script and use the logic iterate etc..

its hard though if you want to loop something you need to iterate but maybe you want to not iterate something but iterate a part of it returning the result to the not iterated part up a level, but you can't publish outputs ??? so i got to use a local loop back which dose not seem right ?

anyways that guys funny, i can't believe he actually took the time to write about something he dose not like.

gtoledo3's picture
Yeah, that one cracks me up,

Yeah, that one cracks me up, but I actually can see going on rants about stuff I don't like... though I try to keep it to a minimum :o)

I'm not 100% sure by what you mean by loop, but you can always control a patch via external time base. Command + click on any macro, renderers (and many other patches) and you get the option to control via external time base. You can feed that with patch time + math to get interesting results, or for "looping" like I am thinking of, you can feed the timebase with an interpolation set to linear and "loop", or "mirrored loop" if you want weird backwards stuff. Also, open up smokris's explode example in the particle tools for a cool example of pausing something via external timebase.

Another interesting patch when it comes to time base madness is the replicate in time.

cybero's picture
JavaScript for Quartz Composer Guide

It might prove to be a useful resource to you & has been posted as a discussion item, a JavaScript for Quartz Composer Guide has been published by me based upon & translated from the one found at openspc and with the kind permission of the original author, Kazuhiro Furuhata.

Hopefully some of us will find it to be useful.

I have attached a zipped version of the guide if you want to peruse it offline too.

PreviewAttachmentSize
QC_JS_GUIDE_Eng.zip438.54 KB

leegrosbauer's picture
Thank you

Much appreciated!

mfreakz's picture
Thanx

Thank you ! That really kind

dust's picture
java script array

well i was thinking more of using a iterate as a while or for loop returning something each iteration to level above it. i don't know what i was thinking yes the interpolate with the external time patch is great for looping index. the external really isn't needed for me unless i am trying to scale a number, but putting a bunch of pics in a folder and using the directory scanner image downloader patches structure count as the max value on interpolate does some cool index looping. i was more thinking of the pink patches are constrained they have no out. you got to put them in render in image to get image out. yeah i guess that works cause i could loop pictures in a iterate then send the image up a level by the render in image. yeah don't know what i was thinking. what i ment by local loop back is to send a iteration word or string or something back to the top level by using osc 127.0.0.1 its called local loopback. but yeah i can see how that would be confusing when most things i do is looped anyways.