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: Best way to produce smooth random motion



On Jun 13, 2005, at 1:56 PM, Dave Hayden wrote:

The easiest way I've found to generate random numbers for seeding an animation is with the _javascript_ patch:

    if ( outputs[0] == null )
        outputs[0] = Math.random();

This works in QC, but doesn't when the qtz is running as a screen saver: _javascript_ in a screen saver always returns the same sequence every time. I've tried to get around this by patching System Time into _javascript_ for a seed value, but there's another difference in the screen saver environment here: it works in QC, but it looks like any number derived from System Time always comes up as NaN in _javascript_.

Anyone seen this before? Does someone have another method for generating random initial values for screen savers?

Here's the latest saver I've thrown together, for your enjoyment:

    http://www.panic.com/~dave/Lissajous.qtz

Thanks,
-Dave

 _______________________________________________
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: 
 >Best way to produce smooth random motion (From: pete boardman <email@hidden>)
 >Re: Best way to produce smooth random motion (From: Pierre-Olivier Latour <email@hidden>)
 >Re: Best way to produce smooth random motion (From: Dave Hayden <email@hidden>)
 >Re: Best way to produce smooth random motion (From: David Coffin <email@hidden>)
 >Re: Best way to produce smooth random motion (From: Dave Hayden <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.