Yay, I got the crossfading between multiple compositions figured out. In case this could be of use to others, or if I have missed something, here is what I did:
1. Generate a random number each time I want to potentially change to showing a different composition. I did this by feeding a Patch Time into a javascript patch that I wrote, which just checks if more than X number of seconds has passed since it last updated its output, and if so, updates its output with the patch time. I feed that into the patch time of a Random patch, and then round the output so that I have integers to work with (I need to know only when the selected composition changes, and not every time the random number is updated). 2. Each of my composition renders to an image, so I can send the output wherever I want. I have each one of them connected to two multiplexers in the same Source locations. One of the multiplexers selects the item based on the rounded value, but I wanted to cross-fade from the old composition to the new one, so I need to know which was the previously selected composition. To do that, I wrote another javascript patch which just remembers the last value and outputs it, and records the new value for use next time. This means that from the outputs of the two multiplexers I have the current and previous compositions. 3. I have a watcher that watches the rounded value of the random number, and triggers a stopwatch which feeds into an interpolation which goes to a dissolve patch. In this way, whenever the composition that is being rendered switches from one to the next, the image and target image switch to their new values, and the time is reset to 0 and fades from one to the other to smoothly transition from one to the next. The output is then displayed on a billboard. I wouldn't mind sharing it with others if this would be useful. If so, please let me know where I can upload it. I have fully commented it so it should be very easy to understand both to use as an end user, and to change the behavior if you're wanting to do something else with it. I've only been using Quartz composer for a few days, so I hope I haven't missed anything important - I'm very impressed with the capabilities of it! Regards Gideon King NovaMind Software Mind Mapping at its best NovaMind NovaMind Gallery HubPages Squidoo Be my friend on: LinkedIn FaceBook On 11/07/2012, at 7:16 PM, Achim Breidenbach <ac...@boinx.com> wrote: > Hi, > > if you want to blend between compositions, I guess you have to render them in > two textures first (with each of the compositions in one Render In Image > Patch) and use the Dissolve patch to fade between those. Use a Multiplexer > patch (with input type "Image") so switch between your "Render In > Image"-Outputs. > > "There are no silly questions, only stupid answers." :-) > > best, > > Achim Breidenbach > Boinx Software > > On 11.07.2012, at 09:32, Gideon King wrote: > >> Thanks Achim and Alastair, >> >> I have solved the issue with the text by setting the font size using pixels >> to units and looking at the resultant size - it's always the same so I can >> just use that value, and do all the calculations in my app, then use an >> input to pixels to units into the Y position of the sprite. Once I realized >> that everything is center based and not flipped, I got the dimensions right >> and it works like a charm. >> >> I'll have another think about the random choice of animations. I could do >> the choosing in my app and just fire off the new value and get it to disable >> the old animation and enable the next, but the thing is that I want to fade >> one out and the next one in, and I'm not currently sure how to trigger that. >> Thanks for the pointer to those specific patches - I'll have a look at them >> and see which ones are of use to me for this task. I haven't really done a >> lot of research and exploring for this one yet, so will have a decent play >> before bothering people with too many silly questions… >> >> >> >> Regards >> >> Gideon >> >> On 11/07/2012, at 5:15 PM, Achim Breidenbach <ac...@boinx.com> wrote: >> >>> 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 >>> >>> >> >
_______________________________________________ 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