Created
June 14, 2013 07:24
-
-
Save EpokK/5780086 to your computer and use it in GitHub Desktop.
Subliminal JS
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
<html> | |
<head> | |
<script src="subliminal.js"></script> | |
<script type="application/javascript"> | |
function init() { | |
addSubliminal( | |
[ 'subliminal', 'message', 'affecting', 'web', 'perception', 'subconscious',':)', '$' ], | |
defaultSubliminalParameters | |
); | |
} | |
</script> | |
<title>Subliminal.JS</title> | |
</head> | |
<body> | |
<h1><b>subliminal.js</b>: [c]overt biocomputer programming</h1> | |
<b>What are <a href="http://en.wikipedia.org/wiki/Subliminal_stimuli">Subliminal Messages</a>?</b> | |
<ul> | |
"Subliminal stimuli, contrary to supraliminal stimuli or "above threshold", are any sensory stimuli below an individual's threshold for conscious perception. Some research has found that subliminal messages do not produce strong or lasting changes in behavior. However, a recent review of functional magnetic resonance imaging (fMRI) studies shows that subliminal stimuli activate specific regions of the brain despite participants being unaware. Visual stimuli may be quickly flashed before an individual can process them, or flashed and then masked, thereby interrupting the processing. Audio stimuli may be played below audible volumes, masked by other stimuli, or recorded backwards in a process called backmasking." | |
</ul> | |
</body> | |
<script> | |
init(); | |
</script> | |
</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
var defaultSubliminalParameters = { | |
framePeriod: 30 /* milliseconds between each frame */, | |
font: '190px Arial', | |
textcolor: "rgba(0.9,0.9,0.9,0.9)", | |
rightMargin: 200, | |
topMargin: 100, | |
displayProbability: 0.58, | |
moveProbability: 0.08, | |
messageProbability: 0.08, | |
zindex: -10000, | |
}; | |
function addSubliminal(messages, p) { | |
var root = document.body; | |
var canvas = document.createElement('canvas'); | |
canvas.setAttribute('style', 'position: fixed; pointer-events: none; z-index: ' + p.zindex); | |
root.insertBefore(canvas, root.firstChild); | |
var message = ''; | |
var x = 0, y = 0; | |
function update() { | |
var width = document.body.clientWidth; | |
var height = document.body.clientHeight | |
canvas.width = width; | |
canvas.height = height; | |
var ctx = canvas.getContext("2d"); | |
// Clear the screen | |
ctx.font = p.font; | |
ctx.clearRect(0,0,width,height); | |
if ((Math.random() < p.messageProbability) || (message == '')) { | |
message = messages[parseInt(Math.random() * messages.length)]; | |
} | |
if ((Math.random() < p.moveProbability) || ((x == 0) && (y==0))) { | |
x = Math.random()*(width-p.rightMargin); | |
y = Math.random()*(height-p.topMargin)+p.topMargin; | |
} | |
if (Math.random() < p.displayProbability) { | |
// Display the text in the new position | |
ctx.fillStyle = p.textcolor; | |
ctx.fillText(message, x, y); | |
} | |
} | |
if (canvas.getContext) { | |
setInterval(update, p.framePeriod) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment