• 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: Paul Skinner <email@hidden>
  • Date: Thu, 13 Mar 2003 21:43:04 -0500

Thanks to everyone who posted to help me with this!

I wound up using the circle code that Doug posted (well it was almost AppleScript syntax, even if you didn't think so) to generate data for the handler. Reducing the computations seemed necessary for smooth execution. And then, while I was working on it, I saw Emmanuel's post. I like that shake! I did one too (NodWindow). And since I was on a roll I made one that says No!
I used the circle code to generate the data for all three handlers so that the movement would be sinusoidal instead of sawtooth. I think it adds that Aqua gooey feelin'.



tell application "Finder"
set w to window 1
end tell
whirlWindow(w)

on whirlWindow(w)
--The window will move clockwise in three progressively smaller circles.
set {xvalues, yvalues} to {{2, 7, 15, 25, 35, 43, 48, 50, 48, 43, 35, 25, 15, 7, 2, 0, 1, 3, 6, 10, 14, 17, 19, 20, 19, 17, 14, 10, 6, 3, 1, 0, 0, 1, 3, 5, 7, 9, 10, 10, 10, 9, 7, 5, 3, 1, 0, 0}, {-10, -18, -23, -25, -23, -18, -10, 0, 10, 18, 23, 25, 23, 18, 10, 0, -4, -7, -9, -10, -9, -7, -4, 0, 4, 7, 9, 10, 9, 7, 4, 0, -2, -4, -5, -5, -5, -4, -2, 0, 2, 4, 5, 5, 5, 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 - (item i of xvalues)), (yPrime - (item i of yvalues))}
end repeat
set position of window 1 to {xPrime, yPrime}
end tell
end whirlWindow



tell application "Finder"
set w to window 1
end tell
NodWindow(w)

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




tell application "Finder"
set w to window 1
end tell
ShakeWindow(w)

on ShakeWindow(w)
--The window will shake back and forth horizontally three times.
set xvalues to {2, 7, 15, 25, 35, 43, 48, 50, 48, 43, 35, 25, 15, 7, 2, 0, 1, 4, 9, 15, 21, 26, 29, 30, 29, 26, 21, 15, 9, 4, 1, 0, 1, 3, 6, 10, 14, 17, 19, 20, 19, 17, 14, 10, 6, 3, 1, 0}
tell application "Finder"
activate
set {xPrime, yPrime} to position of w
repeat with i from 1 to length of xvalues
set position of window 1 to {(xPrime - (item i of xvalues)), yPrime}
end repeat
set position of window 1 to {xPrime, yPrime}
end tell
end ShakeWindow


Paul Skinner

I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it.
-Jack Handy Deep Thoughts _______________________________________________
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.
  • Follow-Ups:
    • Re: Code for a circle
      • From: Malcolm Fitzgerald <email@hidden>
  • Prev by Date: Re: UI Scripting Safari
  • Next by Date: Re: Import Quark document into Quark
  • Previous by thread: Re: Code for a circle
  • Next by thread: Re: Code for a circle
  • Index(es):
    • Date
    • Thread