Results 1 to 9 of 9

Thread: Best approach to animating lots of images?

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2013
    Location
    United Kingdom
    Posts
    8

    Best approach to animating lots of images?

    I need to do simple 2D modelling of atoms & molecules (random walk motion etc) but am not sure of the best approach as there seems to be many ways of animating on a form.

    My own simple experiment was to use (in very basic outline):

    Code:
    Dim graWindow As Graphics
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            graWindow = Me.CreateGraphics     'initialise "canvas"
        End Sub
    
        Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
            iterations = 0
            Do until iterations = maxIterations
                 atoms = 0
                 Do Until atoms = numberOfAtoms
                     <...code to calculate new "atom co-ords"...>
                     graWindow.FillEllipse(<...some colour...>,<...new "atom" co-ords & size data...>) 'put atom on screen
                     <...some sort of delay...>
                     graWindow.FillEllipse(<...background colour...>,<...new "atom" co-ords & size data....>)   'delete atom from screen
                     atoms += 1
                  Loop
                  iterations += 1
            Loop
        End Sub

    However, I don't know if this is the accepted/standard way to animate things in VB. I've seen one code where animation was done (on a single image) using a picture box control to contain the drawn shape. But would this work for 500-1000 little picture boxes?

    I'm (obviously) not experienced in VB 2012 so any detailed help on this would be great.

    Thx
    Last edited by pyeeyp; Jun 17th, 2013 at 06:52 AM. Reason: Formatting error

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width