Re: Sine of the times: Much better window shaker
Re: Sine of the times: Much better window shaker
- Subject: Re: Sine of the times: Much better window shaker
- From: Nigel Garvey <email@hidden>
- Date: Sun, 23 Mar 2003 00:55:20 +0000
has wrote on Sat, 22 Mar 2003 20:39:06 +0000:
>
Nigel Garvey wrote:
>
>
>Emmanuel wrote on Fri, 21 Mar 2003 22:19:18 +0100:
>
>
>
>>I can't resist. Here are the best settings for me:
>
>>
>
>>----------------------------
>
>>on DCPSNodWindow(w, nSteps) -- David Crowe, Paul Skinner et al.
>
>> set theDamping to 5
>
>> set theAmplitude to 50
>
>> set thePeriods to 10
>
>> tell application "Finder"
>
>> activate
>
>> set {xPrime, yPrime} to position of w
>
>> repeat with i from 1 to nSteps
>
>> set position of window 1 to {xPrime, yPrime +
>
>>theAmplitude * (exp (-theDamping * i / nSteps)) * (sin (i *
>
>>thePeriods * pi / (nSteps)))}
>
>> end repeat
>
>> set position of window 1 to {xPrime, yPrime}
>
>> end tell
>
>>end DCPSNodWindow
>
>
>
>Lovely. :-) On my slower machine, the performances of this and Paul's
>
>circle are less laboured if the Satimage calculations are taken out of
>
>the "Finder" tell block. This is also true on the faster machine, but the
>
>difference is not so noticeable.
>
>
Don't forget Paul's original optimisation:
Right. I took a late interest in this thread.
>
unless the on-the-fly math
>
is absolutely necessary, a list of precalculated values is the way to
>
go for both performance and portability. Simple, and smart.
Provided you know what the values are going to be in advance. To do that
here, you'd need to impose a limitation on the possible values of nSteps.
Actually, I got round to downloading the Satimage OSAX for OS X today, so
I was able to try out the script there. It's so *fast* in X that the
effect's more like a twanged ruler than the stately, damped bounce that
I'd enjoyed in 9.2.2. Easily missed unless you have a matching sound
effect. Maybe it really needs a few *more* tell blocks now. ;-)
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.