Your skill will accomplishwhat the force of many cannot PerlMonks

### Tk Optical Illusion

by zentara (Archbishop)
 on Dec 13, 2005 at 16:22 UTC Need Help??
 Description: Just a little Tk script to demonstrate the "persistence-of-image" problem in eyes. It's safer than looking at the sun. :-) Just stare at the cross-hairs, you should see a pink orb, where there is none. UPDATE: I fixed a logic error which caused it to skip at 7 o'clock.
```#!/usr/bin/perl
use warnings;
use strict;
use Tk;

# stare at the cross-hairs, a pink orb
# should appear rotating, where there is none

my \$mw = MainWindow->new();

# first create a canvas widget
my \$canvas = \$mw->Canvas(width => 600, height => 600,
-bg => 'gray',
)->pack();

my %pos;
my \$angle = 0;
my \$pos;
my \$hidden = 0;

foreach my \$pos(0..11){

my \$x = 300 + sin(\$angle)*\$radius;
my \$y = 300 + cos(\$angle)*\$radius;
my \$x1 = \$x - 40;
my \$y1=  \$y - 40;

\$pos{\$pos} = \$canvas->createOval(\$x,\$y,\$x1,\$y1,
-fill => 'green',
-outline=>'green',
-tags => [\$pos],
# -stipple => 'gray75',
);
\$angle += .5236; # (pi / 180) * 30
}

\$canvas->createLine(260,280,300,280,
-width=>5, -fill=>'black');
\$canvas->createLine(280,260,,280,300,
-width=>5, -fill=>'black');

my \$ebutton = \$mw->Button(-text => 'Exit',
-command => 'Tk::exit')->pack();

\$pos = 0;
my \$timer = \$mw->repeat(100,sub{
\$canvas->itemconfigure(\$pos{\$hidden} , -state => 'normal');
\$canvas->itemconfigure(\$pos{\$pos}, -state => 'hidden');
\$hidden = \$pos;
\$pos++;
if(\$pos == 12){ \$pos=0 };
});

MainLoop();

```
Replies are listed 'Best First'.
Re: Tk Optical Illusion
by Celada (Monk) on Dec 13, 2005 at 17:04 UTC

I don't see a pink orb, but I do feel a little weird after watching it for a minute or two. I think maybe the monestary is too bright for the effect to work here. Maybe the orb will reveal itself to me later today when I least expect it? Also I have an LCD now. I will pray again later before a CRT altar and see if I get a new effect.

Well what is supposed to happen, is the green circles dissapear 1 at a time, in a counter clockwise fashion. Where there is no green circle, your eye should see a pink circle. See if you can see it here.

Maybe the lcd screen dosn't change pixels fast enough for it to work?

I'm not really a human, but I play one on earth. flash japh

Lcd monitors (standalone or those of notebooks) currently in use are fast enough. This was not the case with the lcd displays of laptops ten years ago. (I think this is why they're now called TFT instead of LCD.)

I've followed the link you gave and I've seen the illusion. It's very wierd how the pink dots disappear and sometimes reappear when you stare on the middle cross. I have a tft monitor btw.

Sorry, I misunderstood you! I see the pink orb going around the circle just fine. I thought I was supposed to see a pink orb in the middle (on the crosshairs), the explanation ostensibly being that my eyes glance at the pink orb around the circumference when I see movement there and the persistence of vision is supposed to show me the orb in the middle when I go back to starting at it.

Apparently the illusion of the pink orb going around was so strong for me that I never stopped to think that was the illusion!

No wonder I thought I had missed where the creation of the circulating pink orb occured when I scanned the code! I feel a little silly now... (Oh and maybe still a bit weird from staring at the pattern!)

I see it on LCD without problem. It's 'Neovo F-417'

Create A New User
Node Status?
node history
Node Type: snippet [id://516342]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2018-04-22 14:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (83 votes). Check out past polls.

Notices?