Excel Optical Illusions #11

| 4 Comments | 0 TrackBacks

This week's Excel Optical Illusion is quite different. It's a Stereokinetic illusion.

stereokinetic.gif
How's that for an advanced Excel chart?

The depth of field is totally illusory. The actual chart contains a check box to turn the chart animation on and off. 

This is a bubble chart with a tiny bit of VBA thrown in, just for the animation. Here is the VBA in it's entirety:


Public Sub Animate_Figure()

    Dim ws As Worksheet
    
    Set ws = ActiveWorkbook.Sheets("1")
    With ws
        Do
            If Not .[Animate] Then GoTo exit_here
            If .[i] = 1 Then .[i] = .[n] + 1
            .[i] = .[i] - 1
            DoEvents: DoEvents
        Loop
    End With
    
exit_here:
    Set ws = Nothing

End Sub


The actual chart is smoother than the animated GIF displayed here. You can adjust the speed of the animation by changing the number of points in an orbit on the chart worksheet.

It looks much better in Excel 2007 and above, but works for all versions. Let me know what you think of this...

Like most of my Optical Illusions, the inspiration comes from Michael Bach's fantastic site.

More to come. Here's the chart:



Reblog this post [with Zemanta]
If you liked this article, please share it!



Your Ad Here

No TrackBacks

TrackBack URL: http://www.excelhero.com/cgi-bin/mt/mt-tb.cgi/36

4 Comments

Very cool. I put another one along side, made the innermost circle black, and added an evil looking mouth. Scared the 4 year old half to death.

Very funny, Jeff!

Very clever, but I have Manual Cal on by default and nothing happened till I changed it to Auto.
To save me from changing it back I made a slight change to the code - as below.

Public Sub Animate_Figure2a()
Dim ws As Worksheet
Dim cal As Variant
cal = Application.Calculation
Application.Calculation = xlCalculationAutomatic
Set ws = ActiveWorkbook.Sheets("1")
With ws
Do While [animate] = True
On Error GoTo exit_here
If .[i] = 1 Then .[i] = .[n] + 1
.[i] = .[i] - 1
DoEvents
Loop
End With
exit_here:
Set ws = Nothing
Application.Calculation = cal
End Sub

Also it seemed to run ok with only one DoEvents.

Nice post. Thank you for taking the time to issue this information very positive! I’m still waiting for some interesting outlook from your side in your next post thanks!

Custom Dissertations

Leave a comment

About this Entry

This page contains a single entry by Daniel Ferry published on April 30, 2010 11:35 PM.

Excel Optical Illusions #10 was the previous entry in this blog.

Multi-threaded VBA is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.