Re: Code for a circle
Re: Code for a circle
- Subject: Re: Code for a circle
- From: Paul Skinner <email@hidden>
- Date: Thu, 20 Mar 2003 10:12:29 -0500
On Wednesday, March 19, 2003, at 04:44 PM, Malcolm Fitzgerald wrote:
I've been away for a week so I'm still catching up with the movers and
shakers on the list.
Paul's handlers all work beautifully but I wonder if there is a way to
generate the values using formulae. It seems to me that lists could be
obtained on the fly.
At 9:43 PM -0500 13/3/03, Paul Skinner wrote:
on NodWindow(w)
--The window will shake up and down three times.
set yvalues to {-5, -10, -14, -18, -21, -23, -25, -25, -25, -23, -21,
-18, -14, -10, -5, 0, 5, 10, 14, 18, 21, 23, 25, 25, 25, 23, 21, 18,
14, 10, 5, 0, -3, -6, -8, -11, -12, -14, -15, -15, -15, -14, -12,
-11, -8, -6, -3, 0, 3, 6, 8, 11, 12, 14, 15, 15, 15, 14, 12, 11, 8,
6, 3, 0, -2, -4, -6, -7, -8, -9, -10, -10, -10, -9, -8, -7, -6, -4,
-2, 0, 2, 4, 6, 7, 8, 9, 10, 10, 10, 9, 8, 7, 6, 4, 2, 0}
tell application "Finder"
activate
set {xPrime, yPrime} to position of w
repeat with i from 1 to length of yvalues
set position of window 1 to {(xPrime), yPrime - (item i of
yvalues)}
end repeat
set position of window 1 to {xPrime, yPrime}
end tell
end NodWindow
--
--
Malcolm Fitzgerald
You can generate them on the fly, but for smooth action, I found hard
coding the values to produce the best results.
Here's the code to generate the data. It simply records the values that
it generates on the fly
set xvalues to {}
set yvalues to {}
tell application "Finder"
activate
try
set frontWindow to window 1
set {centerx, centery} to position of frontWindow
set steps to 16
set radiusList to {25, 15, 10}
set angle to pi / steps
repeat with radius in radiusList
set phi to 0
repeat steps * 2 times
set phi to phi + angle
set x to centerx + radius * (cos (phi)) - radius
set y to centery + radius * (sin (phi))
--set x to centerx-- Decomment to constrain motion to vertical
only.
--set y to centery -- Decomment to constrain motion to
horizontal only.
tell application "Finder"
set position of window 1 to {x, y}
end tell
set the end of xvalues to round (centerx - x)
set the end of yvalues to round (centery - y)
end repeat
end repeat
set position of window 1 to {centerx, centery}
end try
end tell
{xvalues, yvalues}
_______________________________________________
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.