• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Code for a circle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code for a circle


  • Subject: Re: Code for a circle
  • From: Malcolm Fitzgerald <email@hidden>
  • Date: Fri, 21 Mar 2003 12:38:15 +1100

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 10:12 AM -0500 20/3/03, Paul Skinner wrote:
You can generate them on the fly, but for smooth action, I found hard coding the values to produce the best results.

I expected that the hard-coded list would produce a faster result but the difference is nominal. Building the lists before starting the motion is sufficient to ensure that the visible action in the finder is smooth.

try
tell application "Finder"
set frontWindow to window 1
set {centerx, centery} to position of frontWindow
end tell
end try
--
set xvalues to x_values(centerx)
set yvalues to y_values(centery)
--
try
tell application "Finder"
activate
repeat with i from 1 to length of xvalues
set position of window 1 to {item i of xvalues, item i of yvalues}
end repeat
set position of window 1 to {centerx, centery}
end tell
end try


on x_values(centerx)
try
set xvalues to {}
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 x to centerx-- Decomment to constrain motion to vertical only.
set the end of xvalues to x
end repeat
end repeat
end try
return xvalues
end x_values

on y_values(centery)
try
set yvalues to {}
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 y to centery + radius * (sin (phi))
--set y to centery -- Decomment to constrain motion to horizontal only
set the end of yvalues to y
end repeat
end repeat
end try
return yvalues
end y_values

--
--
Malcolm Fitzgerald email@hidden
Database Manager http://www.asauthors.org
The Australian Society of Authors ph: 02 93180877 fax: 02 93180530
_______________________________________________
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.

References: 
 >Re: Code for a circle (From: Paul Skinner <email@hidden>)

  • Prev by Date: Re: max script size
  • Next by Date: passing info back
  • Previous by thread: Re: Code for a circle
  • Next by thread: Re: Code for a circle
  • Index(es):
    • Date
    • Thread