Last active
August 29, 2015 14:07
-
-
Save PuercoPop/97c9e90dd1a0899cc202 to your computer and use it in GitHub Desktop.
Instructions: 1. Stare at the background and you will see a green dot rotating. 2. Follow the green dot and it will disappear. 3. Focus on the '+' in the middle and after a while the pink dots will disappear 4. Stare at the top circle and more weird stuff happens. Adapted from: http://visualfunhouse.com/animations/disappearing-dots-illusion.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ql:quickload :lispbuilder-sdl) | |
(in-package :lispbuilder-sdl) | |
(defparameter *radius* 50 "The radius of the button in Pixels.") | |
(defparameter *active-color* (sdl:color :r 178 :g 178 :b 178)) | |
(defparameter *inactive-color* *magenta*) | |
(defvar *active* 0 "The index of the 'active' circle.") | |
(defparameter *positions* (list (point :x 300 :y 100) ; Top | |
(point :x 441.42136 :y 158.57864) ; Top-Right | |
(point :x 500 :y 300) ; Right | |
(point :x 441.42136 :y 441.42136) ; Bottom-Right | |
(point :x 300 :y 500) ; Bottom | |
(point :x 158.57864 :y 441.42136) ; Bottom-Left | |
(point :x 100 :y 300) ;; Left | |
(point :x 158.57864 :y 158.57864)) ; Top-Left | |
"List of points where the radius go. 200 distance from the center at | |
(300,300) ") | |
(sdl:with-init () | |
(sdl:window 600 600 :bpp 24 :sw t) | |
(setf (frame-rate) 10) | |
(sdl:with-events () | |
(:quit-event () t) | |
(:idle () | |
(draw-box-* 0 0 600 600 :color *active-color*) | |
(loop | |
:for center :in *positions* | |
:for index :from 0 | |
:do (draw-filled-circle center *radius* | |
:color (if (eql index *active*) | |
*active-color* | |
*inactive-color*))) | |
(draw-line (point :x 290 :y 300) | |
(point :x 310 :y 300) | |
:color *black*) | |
(draw-line (point :x 300 :y 290) | |
(point :x 300 :y 310) | |
:color *black*) | |
(setf *active* (if (< (1+ *active*) (length *positions*)) | |
(1+ *active*) | |
0)) | |
(sdl:update-display)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment