• 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: Sine of the times: Much better window shaker
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sine of the times: Much better window shaker


  • Subject: Re: Sine of the times: Much better window shaker
  • From: LE STANG Jean-Baptiste <email@hidden>
  • Date: Sat, 22 Mar 2003 00:16:28 +0100

Here is an other one, that will make your window describing a window arouna given point of the screen

on SpiralShakeWindow(w, destination)
set numPeriods to 10 -- the number of turns arouns the final point
set numberOfSteps to 40 -- the number of steps for each turn
set {xFinal, yFinal} to destination -- the cneter of the spiral
set stepF to 2 * pi / numberOfSteps -- the step of the angle

tell application "Finder"
activate
set {xPrime, yPrime} to position of w

set theta to atan ((yPrime - yFinal) / (xPrime - xFinal))

if xFinal > xPrime then set theta to theta + pi -- check taht we took the good angle

repeat with i from 0 to numberOfSteps * numPeriods
set r to my getDistance({xFinal, yFinal}, {xPrime, yPrime})
set theta to theta + stepF
set newX to xFinal + r * (1 - i / (numberOfSteps * numPeriods)) * (cos (theta))
set newY to yFinal + r * (1 - i / (numberOfSteps * numPeriods)) * (sin (theta))
set position of window 1 to {newX, newY}
end repeat
end tell

end SpiralShakeWindow

on getDistance(centerF, pointF)
return sqrt (((item 2 of centerF) - (item 2 of pointF)) ^ 2 + ((item 2 of centerF) - (item 2 of pointF)) ^ 2)
end getDistance

tell application "Finder"
set w to window 1
set destination to {500, 200}
end tell

SpiralShakeWindow(w, destination)


Le vendredi, 21 mars 2003, ` 22:43 Europe/Paris, LE STANG Jean-Baptiste a icrit :

Le vendredi, 21 mars 2003, ` 22:19 Europe/Paris, Emmanuel a icrit :

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!

I really like this one !

JB
_______________________________________________
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.
_______________________________________________
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: Sine of the times: Much better window shaker
      • From: LE STANG Jean-Baptiste <email@hidden>
References: 
 >Re: Sine of the times: Much better window shaker (From: LE STANG Jean-Baptiste <email@hidden>)

  • Prev by Date: Re: AppleScript and Excel VBA returning different values for particular column
  • Next by Date: Re: Sine of the times: Much better window shaker
  • Previous by thread: Re: Sine of the times: Much better window shaker
  • Next by thread: Re: Sine of the times: Much better window shaker
  • Index(es):
    • Date
    • Thread