Hello Gideon, regarding the image height: You also could feed in the y-position where the text should be above (or below) and calculate the y position of the sprite in your composition depending on this value and the half text image height. With this, you don't need to know the text height outside your composition. Anyways: QuartzComposer is "value-pull-based" which means, that only such patches gets processed that are currently needed to calculate any output on screen. Your sprite is the first one to be executed. This patch asked their input patches for their output values which then recursively ask their previous patches for their outputs, and so on. this gives sometimes the issue of values are coming up a frame later than expected.
Your random timer problem can be solved on different ways. The hard way is to use the native QC patches, like Stop Watch, Random, Sample&Hold, Watcher-Patch and Pulse-patches. The other way would be to use the JavaScript to implement this in a short state machine. This is for sure the easier way, but the current JavaScript implementation make some trouble if you running QuartzCompositions in a host app. Thats why we choose to use a LUA patch to implement this kind of logics. best, Achim Breidenbach Boinx Software On 10.07.2012, at 19:27, Gideon King wrote: > Thanks Achim, > > I would not have guessed even half of that, but it all makes sense. I have > implemented and tested it and it works fine :) > > So the next thing is that at different times during running the application, > I have other things on the screen (e.g some other text), and I want to make > sure that the scrolling text doesn't go across those places. I therefore want > to know the height of the text, so I can set the Y position before the text > goes across. > > There is an output from the Image With String, which is the display height. > When I first set the text, I ask for that value, and it returns 0. After the > first text has scrolled across and I set the second string value, when I ask > for the height, I do get a value - but by then it's too late for the first > line of text. I would like to know what that height is going to be before the > first text comes across. > > > I believe there is just one other tricky bit of logic I am having problems > with: I have found a few animations I want to use (it's kind of like a > screensaver scenario), and I want to choose which one to play next at random, > fade the one that's playing out, and fade the new one in. > > I have found a Random patch, and a Fade patch. Basically I think I would need > something that ran a timer for the duration I want an animation shown, and > when that finishes, it would trigger another timer that would feed into a > fade, and once that timer was finished, it would somehow get a random number > generator to choose which animation to show next, and it would enable that > animation and set a fade in timer etc. > > If I can get that one solved, I think I probably have all the bits to achieve > my objective. > > > > Regards > > Gideon > > > > > > > > On 11/07/2012, at 2:05 AM, Achim Breidenbach <ac...@boinx.com> wrote: > >> Hello Gideon, >> >> regarding your first problem of restarting your animation: I would use a >> Stop Watch patch and use its time output to be put in the Time input of your >> Interpolation Patch, but for this you have to set the timebase of your >> Interpolation Patch to "External". Then I would observe the incoming text >> value with a "Watcher" patch and restart the stop watch once the text >> changes. (put the output from the watcher to "Reset" and "Stop" and via a >> Logic patch set to "NOT" to the Start input. I hope this works for you. >> >> I am not sure if I understand the second issue completely. Maybe you can >> describe this in more detail? >> >> best, >> >> Achim Breidenbach >> Boinx Software >> >> >> On 10.07.2012, at 17:14, Gideon King wrote: >> >>> Hi, I'm just starting to explore QC, and am trying to put together >>> something that will scroll some text across the screen, then I will later >>> give it some different text and want to restart the animation to scroll >>> that across the screen. >>> >>> To create the image of the text, I am using the "Image with string" object, >>> and have published the text string input as "ScrollingLineOfText". I have >>> linked the image output to a sprite to display it. >>> >>> To get it to move across the screen, I have an "Interpolation" object >>> currently going from 2 to -2 with no repeat, and have linked that to the X >>> position of the sprite. >>> >>> I can set the text from my program by using setValue:forInputKey:, and the >>> text scrolls across the screen (yay!). >>> >>> Where I am running into problems is when I want to restart the animation. I >>> have published the Enable property of the sprite as "ScrollingLineEnabled", >>> and have set the timebase of the Interpolation to "Local", which I read is >>> what you are supposed to do. When I run it in the preview and turn the >>> enabled property off and on, it restarts the animation as expected. >>> >>> In my program, I try to turn the enabled property off and on, and change >>> the text with: >>> >>> [qcLayer setValue:[NSNumber numberWithBool:NO] >>> forInputKey:@"ScrollingLineEnabled"]; >>> >>> [qcLayer setValue:[scrollingText objectAtIndex:itemNumber] >>> forInputKey:@"ScrollingLineOfText"]; >>> >>> [qcLayer setValue:[NSNumber numberWithBool:YES] >>> forInputKey:@"ScrollingLineEnabled"]; >>> >>> But the animation doesn't get restarted. Can anyone shed any light on this? >>> Is there some configuration option I am missing? >>> >>> Also, I want to be able to set the Y position of the text depending on what >>> else is on the screen at the time and the height of the text, so I have >>> published the height of the text image as "ScrollingTextHeight", but when I >>> have set the first text and ask for that value, it returns 0. Then when I >>> come through again and change the text, by then there is a value there >>> (presumably as a proportion of the height of the view). How can I get it to >>> work out the height of the image at the start, as soon as I have set the >>> string? >>> >>> >>> Regards >>> >>> Gideon >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Do not post admin requests to the list. They will be ignored. >>> Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) >>> Help/Unsubscribe/Update your Subscription: >>> https://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com >>> >>> This email sent to ac...@boinx.com >> > _______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com