Offsetting the x value/scrolling text.

DaftScrawl's picture

Hello All, Sorry if I'm doing this wrong I'm very new to Quartz Composer and all things programming so please bare with me.

I've been working on live text in quartz composer (see attached qtz file), I'm then using syphon and dropping it into Resolume to had some visual effects/get some interesting feedback. The only issue I have is that the text eventually ends up being written outside of the box the visuals are in which suggests to me I need to find a way to get the x value of the image to offset a certain amount every couple of seconds/frames.

Any suggestions?

I'm running Quartz on an OS Lion machine and really don't know quite what I'm doing (I've had a lot of help from a friend so far but he doesn't seem to know/have the time to work out the scroll issue), I thought the CISumOf8Conics patch might work but for some reason my Quartz doesn't have it, I've also tried getting Resolume to scroll but the shift has a definite end point.

Any assistance/criticism welcome, I need this sort of thing to learn!

Thanks, Daft

PreviewAttachmentSize
VJText03 ELLE.qtz35.83 KB

harrisonpault's picture
Re: Offsetting the x value/scrolling text.

Daft:

Cool composition you are developing. Here are the questions I have for you, that will determine how you should proceed. As more text is typed in, and the string becomes longer do you want to: a) scale it so it fits in the display window? b) slide it so only the last characters (that fit) show in the display window? c) truncate the string (FIFO) so only the last characters show in the display window?

Depending on what you want, you have the width and height of the text block coming out of the Image with String patch (in QC units). Armed with this information and a Math patch and such, you could

a) scale it so the width never exceeds 2 QC units, b) move the x origin so that origin+width never exceeds 2 QC units c) if the width exceeds 2 QC units, trigger a character removal patch that feeds into your multiplexer.

Your approach will really depend on what you want to do with the text information that doesn't fit in the display window at the Font Size you input.

DaftScrawl's picture
Re: Offsetting the x value/scrolling text.

Hi Harrisonpault, Thanks for helping out.

Considering this is probably going to be running for quite a few hours (I'm a Graphic Communication student, this is a degree show piece) I think the truncating the string method may be friendlier to the machine I ultimately end up running this on.

I'll see how I do, I'm not the cleverest of people when it comes to Quartz (As I said before I've had a lot of help.)

Thank you.

harrisonpault's picture
Re: Offsetting the x value/scrolling text.

How did you make out?

DaftScrawl's picture
Re: Offsetting the x value/scrolling text.

I've been attempting to implement your suggestions but I still don't really understand Quartz (This is the first thing I've ever done in it and it was made with help from a friend and grabbing stuff from other people's compositions) I'm having a problem understanding the Math patch at the moment and QC units.

The problem I seem to be having is that there is no fixed width due to each keypress making the image wider.

harrisonpault's picture
Re: Offsetting the x value/scrolling text.

Help from friends and grabbing stuff from other people is definitely the way to go. However, in this case I think a little self study is warranted. Maybe working through some QC tutorials online could give you some useful conceptual frameworks.

With regard to your specific understanding deficits, the Math Patch is a simple serial application of a set of binary operators. If you use the patch Inspector, you can change the number of operations, and select each one. For each operator, you get one additional input port. Hope that helps. The QC canvas dimensions can be a bit challenging. There are both pixels and units. Pixels is easy. QC units are always 2 across (x axis), with the origin in the center. The height (y axis) is usually some multiple of 2 based on the aspect ratio, but also with the origin in the center. Hope that helps, too. Many image patches have both pixel and QC unit output ports available.

I recommended using QC units, because your solution will adapt to different output resolutions

If Math Patch doesn't do you so well, then the Mathematical Expression patch will let you set up an entire expression for evaluation. Variables (letters: a, b, c...) become input ports as soon as they get mentioned in an expression. Maybe you like those better than Math if you think algebraically?

Paul

DaftScrawl's picture
Re: Offsetting the x value/scrolling text.

So to implement option c, I would put a math patch between the value off 'Sample and hold' and the 'remove last character patch' that then feeds into the 'String Mulitplexer'? Would I need to use another image with string patch or rendering destination dimensions patch to specify width?

I'm sorry if I'm being a bit infuriating with my lack of understanding it takes a while for things like this to sink in (I took ages to get a hold of processing)

harrisonpault's picture
Re: Offsetting the x value/scrolling text.

Ha! As always with this crazy qc, it took a lot more fiddling that I estimated, but here is a solution. Perhaps you can dissect it and understand the logic, then perhaps adapt to your exact needs.

What it does is use a Mathematical Expression to determine if the width is greater than 2 QC units, and then it doubles that to get either 0 or 2 out put. Then there is a Math patch that adds it to the output of the check for a Backspace, to obtain the Multiplexor index input. This means there is a third possibility in the multiplex, and I added a new macro Remove First Character, that rubs out whatever is the leftmost character in your display string. (It's just like Remove Last Character, but it substrings from position 1, not 0, and is fed the new string from the @1@2 patch instead of the old string from Sample and Hold.

Hope it helps, and that it inspires you to spend more quality time with the QC editor. It can be so much more infuriating than newbies asking questions, but if you mastered Processing, this too shall yield I'm sure.

Paul

PreviewAttachmentSize
VJText with Truncation.qtz38.28 KB