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: Paul Skinner <email@hidden>
- Date: Fri, 21 Mar 2003 18:06:37 -0500
It seems that your values go to 0 far before your periods end. More
than 6 periods and you're moving the window only a pixel. Perhaps if
you based the damping on the periods?
If anyone's interested I knocked up a very basic oscilloscope for
testing the window movements while I was developing along this thread.
Uses TextEdit so no need to DL anything fancy.
Grab the data for numlist by logging the values you generate in your
Window moving code. This set is from Emmanuel's last version.
set numList to {15, 27, 35, 39, 39, 35, 29, 20, 10, 0, -9, -16, -21,
-24, -24, -21, -17, -12, -6, 0, 5, 10, 13, 14, 14, 13, 10, 7, 4, 0, -3,
-6, -8, -9, -9, -8, -6, -4, -2, 0, 2, 4, 5, 5, 5, 5, 4, 3, 1, 0, -1,
-2, -3, -3, -3, -3, -2, -2, -1, 0, 1, 1, 2, 2, 2, 2, 1, 1, 0, 0, 0, -1,
-1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0}
set maxvalue to 0
repeat with i from 1 to length of numList
set t to item i of numList
if t < 0 then set t to -t
if t > maxvalue then set maxvalue to t
end repeat
set {bar, spacer} to {"", ""}
repeat maxvalue + 1 times
set spacer to spacer & " "
set bar to bar & "x"
end repeat
set t to ""
set tx to ""
repeat with i from 1 to length of numList
set v to item i of numList
if v < 0 then
set thisBar to text 1 thru -v of bar
set thisSpacer to text 1 thru (((length of spacer) - 2 * (-v)) - 1)
of spacer
else
if v is 0 then
set thisSpacer to spacer
set thisBar to "0"
else
set thisSpacer to spacer & " "
set thisBar to text 1 thru v of bar
end if
end if
set tx to tx & thisSpacer & thisBar & return
end repeat
tell application "TextEdit"
set d to make new document at end
set text of d to tx
end tell
Paul Skinner
On Friday, March 21, 2003, at 04:19 PM, Emmanuel wrote:
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
tell application "Finder" to activate
tell application "Finder" to set w to window 1
DCPSNodWindow(w, 20) -- doiiiing!
----------------------------
Emmanuel
_______________________________________________
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.