none
Optical Illusions

    General discussion

  • For those looking for ideas, some nice simple but effective programs could be made to show some optical illusions. 

    Here's a couple to start with:

    Import PVC930 and CDV606

    Saturday, March 20, 2010 1:36 PM
    Moderator

All replies

  • Wow!!  This is awesome.  Got more?  Mind if I blog about this?
    Saturday, March 20, 2010 5:26 PM
    Moderator
  • There are loads to copy on the net, mostly just a few lines of SB code, a couple more I just did: FMW356 CNR593 TTR706.  Sure, use them.

    And another (ZPJ441), the blue and green are both the same colour (Cyan).

    Saturday, March 20, 2010 6:50 PM
    Moderator
  • Ouch my eyes!  You've warped pixels, nice.  Wow, I can't believe the blue=green one, freaky, any idea why that works?  I'm not sure what TTR706 (spinning pink dot) is supposed to do.
    Wednesday, March 24, 2010 6:41 PM
  • bigdaddyo,

    The spinning dot, if you look at the centre cross, it appears that a green 'ghost' dot appears in the space.  If the original dots are yellow, then the ghost dots appear blue. 

    Also, if you stare at it for 30sec+, some of the pink dots around the perimeter seem to disappear for a second or two, leaving a gap of several dots.

    Wednesday, March 24, 2010 6:58 PM
    Moderator
  • The spinning dot, if you look at the centre cross, it appears that a green 'ghost' dot appears in the space.
    That is so cool.
    Wednesday, March 24, 2010 7:09 PM
  • Yeah sure, I know that, the best illusion.

    and the ZPJ441 is really cool !

    see XLG372 - description inside, not so cool, but my first.

    • Edited by Vitexikora Thursday, March 25, 2010 9:08 PM added illusion
    Thursday, March 25, 2010 8:36 PM
  • Vitexikora,

    Simple and very effective.

    Thursday, March 25, 2010 9:59 PM
    Moderator
  • NEW !!!

    All illusions seven-in-one !

    Import: CJR855

    -requires fremy extension

    -personally on my computer, (4) is not working properly. I don´t no why, the code of the animation works only if it stands "alone".

    -please tell me about some mistakes with english.

    Friday, March 26, 2010 4:50 PM
  • Vitexikora,

    You have stumbled over an important issue with SmallBasic which may be a bug.  It took a bit of playing to work this out!

    Basically you cannot start a subroutine that has moving shapes from inside an event subroutine.

    The following fails to work properly:

    GraphicsWindow.KeyDown=OnKeyDown

    Sub OnKeyDown
      illusion4()
    EndSub

    The following works:

    GraphicsWindow.KeyDown=OnKeyDown

    start = 0
    While ("True")
      If (start = 1) Then
        illusion4()
        start = 0
      EndIf
      Program.Delay(100)
    EndWhile

    Sub OnKeyDown
      start = 1
    EndSub

    This seems to also be the case for the Fremy Control button events.

    So, you need to set a flag from the event call, and use this flag to control the program from a Main Loop. 

    This is a recurring theme - do all the main work in the main program loop - and just use events to set control flag variables

    This is extended here to do not call subroutines that do any animation (work) directly from an event .

     

     

    Friday, March 26, 2010 8:00 PM
    Moderator
  • Ok, thanks, I will try to repair it.

    And the event subroutines, you described me should be the main problem of my last programs....

    Monday, March 29, 2010 6:15 AM
  • Yes, I think this is the only problem.
    Monday, March 29, 2010 5:30 PM
    Moderator
  • This thread is featured in the Small Basic blog.

    http://blogs.msdn.com/smallbasic/archive/2010/03/29/optical-illusions.aspx

     

    Monday, March 29, 2010 5:45 PM
    Moderator
  • There are loads of examples of optical illusions and descriptions why/how they work on the net, just google for them, then have a go reproducing them with SmallBasic - most are fairly straight forward to code.

    Tuesday, January 11, 2011 7:52 PM
    Moderator
  • And another (ZPJ441), the blue and green are both the same colour (Cyan).

    Awesome.  I wanted to "prove" to my eyes that the colors were the same, and I wanted to monkey about with the column size, so I made http://smallbasic.com/smallbasic.com/program/?KMT643 (edited to be a link instead of just the letters).

    I cut it down to only 3 rows and made the first part of the bottom row and the latter half of the second row extend into the second row (by making the second row those colors in those spots).  It uses an initially set columnwidth and columnheight to monkey about with the columnsize, so after importing KMT643 on your computer, you can fiddle around with the column sizes (first two variables) each time you run the program.

    Wednesday, January 12, 2011 11:24 PM