Advertisement
imk0tter

Untitled

May 11th, 2011
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. menu * {
  2. Spiral Out:/SpiralOfLife 40
  3. }
  4.  
  5. alias SpiralOfLife {
  6. if (%spiralOfLife) {
  7. Spiral.Destroy
  8. }
  9. Spiral.Create $1
  10. }
  11.  
  12. on 1:close:@SpiralOfLife: {
  13. .timerSpiralofLife off
  14. %spiralofLife = $false
  15. .hfree SpiralOfLife
  16. }
  17. alias Spiral.Destroy {
  18. .timerSpiralOfLife off
  19. close @SpiralofLife
  20. %spiralOfLife = $false
  21. .hfree SpiralOfLife
  22. }
  23.  
  24. alias Spiral.Create {
  25. Spiral.InitWindow
  26. Spiral.InitDots $1
  27. Spiral.StartAnimation
  28. }
  29. alias Spiral.StartAnimation {
  30. .timerSpiralOfLife 0 0 Spiral.RenderScene
  31. }
  32. alias Spiral.InitDots {
  33. var %MultiDirection 0
  34. var %dotCount $1
  35. var %baseSize 4
  36. var %baseDist 4
  37. var %baseAngle 4
  38. var %angleOffset $calc(%baseAngle / (%dotCount + 1) * (1 + %multiDirection))
  39. var %redBase 0
  40. var %redOffset $calc(255 / %dotCount)
  41. var %currDist %baseDist
  42. var %x 1
  43. hadd -m SpiralOfLife DotCount %dotCount
  44.  
  45. while %x <= %dotCount {
  46. var %baseAngle %baseAngle - %angleOffset
  47. hadd -m SpiralOfLife %x $+ .AngleOffset %baseAngle
  48. hadd -m SpiralOfLife %x $+ .Size $calc(%baseSize * ((%x * .05) + 1))
  49. hadd -m SpiralOfLife %x $+ .Angle 90
  50. hadd -m SpiralOfLife %x $+ .Distance %currDist
  51. hadd -m SpiralOfLife %x $+ .Color $rgb(%redBase,35,70)
  52. inc %currDist $calc(%baseSize * ((%x * .05) + 1))
  53. inc %redBase %redOffset
  54. inc %x
  55. }
  56. }
  57.  
  58. alias Spiral.InitWindow {
  59. var %window.h 768
  60. var %window.w 1024
  61.  
  62. hadd -m SpiralOfLife window.midx $calc(%window.w / 2)
  63. hadd -m SpiralOfLife window.midy $calc(%window.h / 2)
  64. hadd -m SpiralOfLife window.w %window.w
  65. hadd -m SpiralofLife window.h %window.h
  66.  
  67. window -aBdfp @SpiralOfLife -1 -1 %window.w %window.h
  68. }
  69.  
  70. alias Spiral.RenderScene {
  71. var %dotCount $hget(SpiralOfLife,DotCount)
  72. drawrect -nrf @SpiralOfLife $rgb(255,255,255) 1 0 0 $hget(SpiralOfLife,window.w) $hget(SpiralOfLife,window.h)
  73. var %lastX, %lastY
  74. var %window.midx $hget(SpiralOfLife,window.midx)
  75. var %window.midy $hget(SpiralOfLife,window.midy)
  76. var %list,%list2,%list3
  77. while %dotCount {
  78. var %length $hget(SpiralOfLife,%dotCount $+ .Distance)
  79. var %dotSize $hget(SpiralOfLife,%dotCount $+ .Size)
  80. var %dotOffset %dotSize / 2
  81. var %NewAngle $calc(($hget(SpiralOfLife,%dotCount $+ .Angle) + $hget(SpiralOfLife,%dotCount $+ .AngleOffset)) % 360)
  82. var %zz $sin(%newAngle).deg
  83. var %newX $calc(%zz * %length + %window.midx - %dotOffset)
  84. ;var %newY $calc($cos(%newAngle).deg * %length + %window.midy - %dotOffset)
  85.  
  86. var %newY $calc($cos($calc(%newAngle * 2)).deg * %length + %window.midy - %dotOffset)
  87. %list = %list $round(%zz,2)
  88. %list2 = %list2 %newX
  89. %list3 = %list3 %newY
  90. var %color $hget(SpiralOfLife,%dotCount $+ .Color)
  91.  
  92. ;Uncomment the next line to draw dots;
  93. ;drawDot -nr @SpiralOfLife %color %dotSize %newX %newY
  94.  
  95. if %lastX != $null && %lastY != $null {
  96. ;Uncomment the next line to draw lines
  97. drawline -nr @SpiralOfLife %color 2 %newX %newY %lastX %lastY
  98. }
  99. var %lastX %newX
  100. var %lastY %newY
  101.  
  102. hadd -m SpiralOfLife %dotCount $+ .Angle %newAngle
  103. dec %dotCount
  104. }
  105. var %dotCount $hget(SpiralOfLife,DotCount)
  106. var %iter $int($calc(%dotCount / 2))
  107. var %x 2,%lastX,%lastY
  108. /*
  109. while %x <= %iter {
  110. if $count(%list,$token(%list,1 - $+ %x,32)) == $floor($calc(%dotCount / %x)) {
  111.  
  112. var %k $v2
  113. var %y %x
  114. while %nny {
  115. var %z %k
  116. while %z {
  117. dec %z
  118. }
  119. dec %y
  120. }
  121. drawsave -q80 @SpiralOfLife SpiralOfLife- $+ %x $+ - $+ $ticks $+ .jpg
  122. %x = $calc(%iter + 1)
  123. }
  124. inc %x
  125. }
  126. */
  127. drawDot @SpiralOfLife
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement