Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LDGraphicsWindow.state = 2                            'full screen
  2. w = GraphicsWindow.Width
  3. h = GraphicsWindow.Height
  4. GraphicsWindow.BackgroundColor = "Black"
  5. numstar = 120
  6. GraphicsWindow.BrushColor = "White"
  7. For x = 1 To numstar
  8.   distx[x] = Math.GetRandomNumber(w)                  'gen rnd x pos for star
  9.   disty[x] = Math.GetRandomNumber(h)                  'gen rnd y pos for star
  10.   If Math.Remainder(x,2) = 0 Then
  11.     distx[x] = -distx[x]                              'move 50% of stars to left/top of central pivot
  12.     disty[x] = -disty[x]
  13.   EndIf
  14.   size = 5+Math.GetRandomNumber(12)                   'size is rnd between 5 and 12
  15.   shape = Shapes.AddEllipse(size,size)
  16.   Shapes.SetOpacity(shape,Math.GetRandomNumber(100))
  17.   Shapes.Move(shape,distx[x],disty[x])
  18.   stars[x] = LDFastShapes.ShapeIndex(shape)           'use ldfastshapes for speed
  19.   sp[x] = Math.GetRandomNumber(150)/100               'speed array of orbitting stars
  20.   sizes[x] = size                                     'size array of stars            
  21. EndFor
  22. While 1=1
  23.   a = a + .5                                          'half degree of rotation per frame
  24.   z = z + 0.0001                                      'slowly increasing height of rotation
  25.   GraphicsWindow.title = z
  26.   For x = 1 To numstar
  27.     sin = Math.Sin(Math.GetRadians(a * sp[x]))        'sin and cos pos of each star
  28.     cos = Math.Cos(Math.GetRadians(a * (sp[x] * z)))
  29.     LDFastShapes.Zoom(x,sizes[x] * sin/2 * distx[x]/10000,sizes[x]*sin/2 * distx[x]/10000)
  30.     xpos = w/2 + distx[x] * (sin/2)                   'W/2 & H/2 become central pivot
  31.     ypos = h/2 + disty[x] * (cos/2)                   'spin faster laterally
  32.     LDFastShapes.Move(x,xpos,ypos)
  33.   EndFor
  34.   LDFastShapes.Update()
  35.   Program.Delay(10)
  36. EndWhile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement