Newtons Cradle


This page originated from the City of Dis. Click to Enter.
 

Welcome To The Custom version of Newton's Cradle.

These pages contain a demo of the cradle and instructions for installing the cradle on your own homepage. If you can't see an animated image immediately above these words, it means that you don't have the necessary plugin to view shockwave. Don't panic! You can download it from http://www.macromedia.com/shockwave (this link opens a new browser). If you're running Internet Explorer, you might have already been asked to confirm an automatic download. (Say "Yes").

Table of Contents

  1. What is "Newton's Cradle"?
  2. What HTML Code Do I Need To Put In My Webpage To Make The Cradle Work?
  3. What Parameters Can I Use? What Can I Customise?
  4. Colours Are Specified Using The Colour Number Of The Windows Palate. How Do I Find Out What the Number Of The Colour I Want To Use Is?
  5. How Do I Upload cradle.dcr To My Website?
  6. What If A Visitor To My Webpage Doesn't Have The Shockwave Plugin?
  7. Javascript for detecting shockwave
  8. What Files Should Have Been in the Zipfile (cradle.zip)?
  9. Custom Versions (specify background picture(s), custom balls, resizing)

What Is Newton's Cradle?

A real-life Newton's Cradle consists of five steel balls suspended from a frame such that the balls are horizontally aligned with each other. By droping any given number of balls, you get an effect similar to that illustrated in the cradle.dcr shockwave movie. The advantage of cradle.dcr is that it allows you to click on the balls and load other webpages. A "real" Newton's Cradle can't do this. Honestly. On the other hand, a real Newton's Cradle is probably a bit more honest about demonstrating the conservation of momentum than the simulation. And so it goes.

The reason I created this rather, ah, electic, method of defining hyperlinks probably has more to do with having too much time on my hands than anything else. But , it was fun, and improved my basic physics no end.

Anyway, this Newton's Cradle is a streaming shockwave movie. It is called "cradle.dcr". It models the motion of a real Newton's Cradle. Additionally, it allows the webmaster to specify between 5 and 10 hyperlinks, define short and long descriptions for them, specify the background colour, and the colour of the balls. It also allows the webmaster to specify the level of help available to his website visitors.

Amazing, eh? If that's not enough, I've also included a couple of tools that will help you get the best out of the cradle.

Oh, as regards bug reports: these are welcome to me, Therion Ware, at <tware@city-of-dis.com> . I regret that because cradle.dcr is freeware, I cannot guarantee to fix any problems you may find immediately, or at all, but "you never know," and I might be able to suggest a workaround.

So, I hope you enjoy the cradle, and remember: if you want a custom version of the cradle (your own graphics, logos, and so on) you can have one for a mere USD 10.00 . Click For Details.

Back To table of contents

What HTML Code Do I Need To Put In My Webpage To Make The Cradle Work?

Back To table of contents

What Parameters Can I Use? What Can I Customise?

NOTE: The term "leftswing" is used to indicate a ball moving from right to left, while the term "rightswing" is used to indicate a ball moving from left to right.

The following parameters are available, and allow the following customisations:

  1. swFrame
    • specifies the target frame of all hyperlinks.
    • If you're not using frames set to "_SELF" (case sensitive)
    • Example: swFrame = "my_main_frame" or swFrame = "_SELF"
  2. swText
    • Authors copyright notice
    • The text between the quotes must be exactly as shown, or the cradle will not work.
    • Example: swText = "author:tware@city-of-dis.com"
  3. sw1
    • specifies the link destination associated with ball 1 on a leftswing, and the link destination associated with ball 1 on a rightswing. Link values are separated by a space.
    • Note the numbering of the links
    • Example: sw1 = "link1.html link6.html"
  4. sw2
    • specifies the link destination associated with ball 2 on a leftswing, and the link destination associated with ball 2 on a rightswing. Link values are separated by a space.
    • Example: sw2 = "link2.html link7.html"
  5. sw3
    • specifies the link destination associated with ball 3 on a leftswing, and the link destination associated with ball 3 on a rightswing. Link values are separated by a space.
    • Example: sw3 = "link3.html link8.html"
  6. sw4
    • specifies the link destination associated with ball 4 on a leftswing, and the link destination associated with ball 4 on a rightswing. Link values are separated by a space.
    • Example: sw4 = "link4.html link9.html"
  7. sw5
    • specifies the link destination associated with ball 5 on a leftswing, and the link destination associated with ball 5 on a rightswing. Link values are separated by a space.
    • Example: sw5 = "link5.html linkA.html"
  8. sw6
    • Link Short Description. 10 words, one word per link. Do not exceed 8 characters.
    • Text
      Description Position
      In Parameter
      Associated
      Ball Number
      left to Right
      Text appears
      when ball is
      moving in This
      Swing Direction
      011RightSwing
      022RightSwing
      033RightSwing
      044RightSwing
      055RightSwing
      061LeftSwing
      072LeftSwing
      083LeftSwing
      094LeftSwing
      105LeftSwing
    • Example: sw6 = "Desc1 Desc2 Desc3 Desc4 Desc5 Desc6 Desc7 Desc8 Desc9 DescA"
    • There's a little more to it than that... As you will understand, some balls don't move in some configurations. This means that some of their associated links never appear. In order to get around this. I've programmed the cradle such that when the balls stop, the two links associated with a particular ball appear on alternate stops.
  9. sw7
    • Specifies background colour, ball 1 colour ... ball 5 colour. 6 decimal numbers in the range 0 - 255.
    • The color numbers refer to colour positions in the windows 95 palate. Use The Shockwave program below to determine what numbers are associated with what colours, or follow the help guide in cradle.dcr itself.
    • Jump To Program
    • Example: sw7 = "003 006 016 008 005 001"
  10. sw8
    • Specifies background colour, ball 1 colour ... ball 5 colour. 6 decimal numbers in the range 0 - 255.
    • The color numbers refer to colour positions in the windows 95 palate. Use The Shockwave program below to determine what numbers are associated with what colours, or follow the help guide in cradle.dcr itself.
    • 10 long descriptions of the link destinations separated by a "|" character. Do not exceed 255 characters in total.
    • Example: sw8 = "Link 1 Long Description|Link 2 Long Description|Link 3 Long Description|Link 4 Long Description|Link 5 Long Description|Link 6 Long Description|Link 7 Long Description|Link 8 Long Description|Link 9 Long Description|Link 10 Long Description"
  11. sw9
    • Two numbers space seperated, both in the range 0..1.The first number controls user access to the colour picker help screen, and the second determines if sound is active at startup.
    • A value of 1 means "yes" and a value of "0" means "no".
    • Example: sw9 = "1 1" or sw7 = "0 1", etc..

Back To table of contents

How Do I Find Out The "Colour Number"?

Use the Shockwave program below, or the one in the helpfile contained in cradle.dcr (make sure parameter sw9 is set to "1").. The numbers represent colours in the native windows 95 palate.
 

Back To table of contents

How Do I Upload cradle.dcr To My Website?

The same way that you would upload any other file. Some browsers allow you to upload. If using an ftp program, do not forget to set the file type to binary, and not text, or as we say technically: "it wont work".

Back To table of contents

What If A Visitor To My Webpage Doesn't Have The Shockwave Plugin?

When using shockwave, it's as well to realise that not everyone has the plugin. This means that some people will not be able to view the cradle. What can we do about this?

Well, frankly, not much. Basically there are three options:

  1. We can use javascript to detect if the visitor has the shockwave plugin, and take appropriate action by either directing them to where they can get the shockwave plugin, or substituting something else for the shockwave presentation. This assumes that the user has a javascript enabled browser: not everyone does.
  2. We can say somewhere on the webpage "If you see nothing here, you haven't got the shockwave plugin. You can get it here".
  3. We can ask the visitor to if they have the shockwave plugin, and ask them to choose an appropriate link based on that choice.

I have tried to combine all of the above options into an, ah, elegant, solution. It should be noted that some of the more modern web browsers with partially automate the plugin download procedure.

Back To table of contents

JavaScript for detecting Shockwave

Back To table of contents

What Files Should Have Been in the Zipfile (cradle.zip)?

The zipfile cradle.zip should have contained the following files:
  1. cradle.dcr - The cradle executable. This is version 2.1.
  2. palnum.dcr - support program integrated into start.html
  3. htmtxt.dcr - support program integrated into start.html
  4. javasc.dir - support program integrated into start.html
  5. readme.txt - text redirection to this file
  6. start.html - this file, the core of the tutorial
  7. link1.html - example link destination 1
  8. link2.html - example link destination 2
  9. link3.html - example link destination 3
  10. link4.html - example link destination 4
  11. link5.html - example link destination 5
  12. link6.html - example link destination 6
  13. link7.html - example link destination 7
  14. link8.html - example link destination 8
  15. link9.html - example link destination 9
  16. linka.html - example link destination 10
  17. nodir.html - called by start.html if shockwave is not installed in the browser

Back To table of contents

Custom Versions (specify background picture(s), custom balls, resizing)

While cradle.dcr is a copyrighted program, it's also free. This means that you can do what you like with it, except that you musn't sell it (assuming you could find a buyer...).

If you want a custom version, containing your own logos, or designs in place of the balls, and a background picture, I can do that for you. All it takes is for you to send me USD 10. There are two ways you can do this. They are, in descending order of desirability:

  1. Pay USD 10 into my American Express Account.
  2. Send me USD 10 cash.
I cannot accept cheques, money orders and similar instruments, mainly because at the moment, I'm working in Malaysia and the cost of clearing them with a bank in another continent is far more that their face value.

Simply mail me with your requirements, stating:

  1. Your Name, or handle.
  2. Your e-mail address
  3. How you intend to pay (cash or crediting my Amex account)
    • I prefer a payment to my Amex account because it's tracable, and will not get lost. This protects both of us.
  4. Please attach the following files to your mail:
    • The five images you want to use in place of the balls (these do not have to be circular, but should not be bigger than 64 pixels by 64pixels).
    • The background image you require.
  5. Any other details you want me to take into account.
I will get back to you within 2 or 3 days, holidays, death, and so on excepted. In the unlikely even that anyone wants the source code, I'm not too keen on parting with it, so it's USD 250.00 .Apart from that, I work as a contract Network Administrator (Novell & NT), Webmaster, I.T. Manager, and specialise in third world countries, that is: "IT under difficult conditions". If you have a contract, or interesting permanent, position available, I'm always interested. Mail me Today!

Back To table of contents