Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Earthquakes in Tao Presentations

By: Christophe3D on Sep 12th, 2012  |  syntax: None  |  size: 2.81 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. import RegExp
  3. import NetworkAccess
  4. import PointCloud
  5. import Animate
  6.  
  7. feed "Earth quakes M >5", "http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M5.xml"
  8.  
  9. feed Title:text, URL:text ->
  10.     page Title,
  11.         clear_color 0, 0, 0, 1
  12.         locally
  13.             Scale := max (window_width / 1920, window_height / 1200)
  14.             locally
  15.                 scale Scale, Scale, Scale
  16.                 translate -550, 350, 300
  17.                 rotatey 40
  18.                 color "yellow"
  19.                 text_box 0, 0, 600, 200,
  20.                     align 0.5
  21.                     vertical_align 0.5
  22.                     font "Ubuntu", 65
  23.                     text Title
  24.             locally
  25.                 cloud_random "Stars", 3000
  26.                 color "white"
  27.                 translate 0, 0, -5000
  28.                 scale 5000, 5000, 3000
  29.                 rotatey 0.1 * time
  30.                 translate -0.5, -0.5, -0.5
  31.                 cloud "Stars"
  32.             locally
  33.                 color "white"
  34.                 texture "http://www.motionstudios.de/images/dwm/Bild4.jpg"
  35.                 if texture_width <> 0 then
  36.                     earth_transform
  37.                     sphere 0, 0, 0, 900, 900, 900, 50, 50
  38.         locally
  39.             process_feed get_url_text URL
  40.  
  41. Scale -> 0.666667
  42.  
  43. earth_transform ->
  44.     light 0
  45.     light_position 1000, 1000, 1000
  46.     scale Scale, Scale, Scale
  47.     rotatey 5 * time
  48.  
  49. Magnitude -> 6.0
  50. Latitude -> -12.5097
  51. Longitude -> 166.497
  52.  
  53. process_feed T:text ->
  54.     // Refresh every second until we get news feed, then every hour
  55.     if T = "" then refresh 1 else refresh 3600
  56.  
  57.     regexp_parse_all T,
  58.         - "<title>M (.*), (.*)</title>" -> Magnitude := real regexp_captured 1
  59.         - "<geo:lat>(.*)</geo:lat>" -> Latitude := real regexp_captured 1
  60.         - "<geo:long>(.*)</geo:long>" -> Longitude := real regexp_captured 1; plot Latitude + 0, Longitude + 0, Magnitude + 0
  61.  
  62. key "w" -> WaveMode := 1 - WaveMode
  63. WaveMode -> 1
  64. Radius -> 16.5
  65.  
  66. plot Lat:real, Long:real, Mag:real ->
  67.     locally
  68.         Radius := 15 * (Mag - 4.9)
  69.         earth_transform
  70.         rotatex -1.0 * Lat
  71.         rotatey Long
  72.         translatez 451
  73.         if WaveMode = 1 then
  74.             map_waves 0, 0, Radius
  75.         else
  76.             color "red"
  77.             line_width 0
  78.             circle 0, 0, Radius
  79.  
  80. WaveCount -> 2
  81. map_circles 0, R -> false
  82. map_circles N:integer, R:real ->
  83.     line_color "red", 0.7 * fade_out_at (N - 1 + page_time mod 1, WaveCount)
  84.     circle 0, 0, (N - 1 + page_time mod 1) * R
  85.     map_circles N - 1, R
  86. map_waves X:real, Y:real, R:real ->
  87.     locally
  88.         disable_depth_mask
  89.         translate X, Y, 0
  90.         color 0, 0, 0, 0
  91.         line_width 3
  92.         map_circles WaveCount, R