Javascript watcher

itsthejayj's picture

Having a bit of a nightmare within a iterator. My problem is the watcher patch not preserved state for each iteration. I think my solution could be a javascript patch with virtual inputs?

Has anyone built a javascript watcher? Could i possible grab it off someone.

Much thanks Happy new year guys

cybero's picture
Re: Javascript watcher

You could always make something like a JavaScript watcher patch but I'm unclear how an iterated virtual watcher patch isn't correctly handling state.

Please find attached what I think your talking about, sans JS .

PreviewAttachmentSize
IteratorWatcher.qtz6.25 KB

itsthejayj's picture
Re: Javascript watcher

Hey cybero, i've attached a simple composition which show what i trying to accomplish and the problem i'm having with the watcher patch inside an iterator.

If you set the amount of iterations to 1 your see that when you change the value of 'amount one' the text appears and then fades away using a smooth patch. What i trying to achieve is this functionality but with more than one iteration.

Hope this explains things better, i think i possibly might be missing some thing obvious here may be you could help out.

PreviewAttachmentSize
watcher_inside_iterator.qtz8.25 KB

cybero's picture
Re: Javascript watcher

Due to the structure of your composition, your iteration level is limited to being represented as much as you have allowed for within the JS, which sets the level for the Current Index within the Iteration patch. If you allow for an array range[n] you'll be able to call upon that current index. As it stands the watcher does work, although it obviously spits its dummy out at past 2 Iterations. See attached redraft.

PreviewAttachmentSize
watcher_inside_iterator_redraft.qtz9.11 KB

itsthejayj's picture
Re: Javascript watcher

Thxs for the input cybero, but i think you miss understanding what i trying to do.

What im trying to achieve is have my numbers flash up on change (alpha = 1) and then fade away after 3 qc units (set by the smooth patch).

The javascript was purely just a structure maker to show that the fade works with one iteration and but not 2 or more.

Thxs, any ideas?

cybero's picture
Re: Javascript watcher

Well you might be teaching me something here, but it seems to me the inc and dec duration on the Smooth could be set as high or as low as you like, they are time units, not specifically qc units as far as I'm aware, although they do get thrown into interpolations and such.

I do get a fade working above 2 iterations on my redraft.

On your comp 0 iterations gives nothing - no surprise - 1 iteration gives a single number stream that does not fade, the current index is then at 0 at 2 iterations the current index increases to 1 and I get the first [top] item fading in a loop like fashion, the bottom item does not fade, if I then set an even higher number of iterations, the Image String gets rendered all on top of one another although, as you can see , if you set the iterations as per my redraft to be equal for that number of structure members, then you'll be able to see that set go to fade, but it seems we are then limited due to the structural nature of this composition to having only as many iterations effectively looped through the fade procedure as we have numbers of structure members.

itsthejayj's picture
Re: Javascript watcher

Iterators just sux, really don't know what Apple is trying to do with iterators.

But for future reference if any body else need something like a javascript watcher here what i did to solved my problem (composition attached)

PreviewAttachmentSize
watcher_inside_iterator2.qtz10.59 KB