Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Many questions




On Nov 4, 2007, at 6:38 AM, Andrew Larking wrote:

Hi all.

I have a few questions, and thought I'd compile them to a list rather then spamming the dev list loads. If I get an answer others may have use for, I can post that as a separate entry later.

OK, let's go.

1 > Let's say I have a sprite moving around using two random nodes, one for X and one for Y, possibly also one for Z but I doubt it. I would like to orient the sprite to the direction it travels. In other words, can I have something with a 'front' move 'forwards'?

2 > Creating trails that fade. Is this possible? I thought it may be if I used the Replicate in Time patch, but can't seem to get it working. Imagine a sprite moving around, I'd like to be able to set a length and have a tail emit to that length.

3 > Enabling with Audio. I'd like to have sprites turn on (Enable) when a certain input level on the audio input node is achieved. I can't figure this one out, I've tried everything I can think of with ranges, multiplexer etc. No joy.

Conditional -> Counter -> Enable. This will be cheaper than JS.



4 > Gravity, or attraction. Is this in any way possible, even as a fake? Let's say I have some sprites, I want them to slowly move together over time. Or have some sprites move toward something else, I'm not fussed what. Basically, can one thing attract another?

5 > Hold and move. Imagine a sprite, it moves to a random point slowly, then pauses for 2-3 seconds, then moves to another random point, this continues. I can get it all working, but can't get the pause/hold part working.

Check /Developer/Examples/Quartz\ Composer/Compositions/Conceptual/ Random\ Value\ Random\ Interval\ 2D.qtz for an example of how to do this using patch logic. Otherwise, you could do the same thing using JavaScript.


// global variables
x = 0;
y = 0;
duration = 0;
startTime = 0;

// main
function (__number x, __number y) main (__number dMin, __number dMax, __number xMin, __number xMax, __number yMin, __number yMax, __number patchTime)
{
var result = new Object();

// if we have a new duration or enough time has passed
if ((duration < dMin) || (duration > dMax) || (patchTime - startTime > duration)) {
// set the start time
startTime = patchTime;

// randomize our duration and position
duration = rnd(dMin, dMax);
x = rnd(xMin, xMax);
y = rnd(yMin, yMax);
}

// return our results
result.x = x;
result.y = y;
return result;
}


// rnd: returns a random value within the specified range
function rnd(_min, _max) {
	result = Math.random()*(_max-_min)+_min;
	return result;
}

Here's a composition which shows this JavaScript in use.

Attachment: Random Position Random Interval - JavaScript.qtz
Description: application/quartzcomposer





Many thanks for looking through this, and thanks on advance for any/ all help.

Regards.

Andrew.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (email@hidden )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden


This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden

References: 
 >Many questions (From: Andrew Larking <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.