Thursday, November 3, 2011
CSS in CSS
Another code story! But this time it's actually music lyrics. I decided to envision what the song "Music is My Hot Hot Sex" by the band CSS (Cansei der Ser Sexy) might look like in CSS.
Here's my interpretation:
The original lyrics for the portion I've converted above, for your reference, is here:
Here's my interpretation:
@charset "utf-8";
body #drugs .music {
font-weight: bolder; !important
}
body #junks .music {
font-weight: bolder; !important
}
body #boys .music {
font-weight: bolder; !important
}
body #ladies .music {
font-weight: bolder; !important
}
.music {
background:url(boyfriend.jpg);
}
.music {
background:url(girlfriend.jpg);
}
.music {
background:url(deadEnd.jpg);
}
.music {
background:url(imaginaryFriend.jpg);
}
.music {
background:url(brother.jpg);
}
.music {
background:url(greatGranddaughter.jpg);
}
.music {
background:url(sister.jpg);
}
.music {
background:url(favoriteMistress.jpg);
}
table #shit .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
table #jobs .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
table #drinks .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
table #bitches .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
.music {
background:url(beachHouse.jpg);
}
.music {
background:url(homeTown.jpg);
}
.music {
background:url(kingsizeBed.jpg);
}
.music {
background:url(meetMyFriends.jpg);
}
.music {
background:url(hotHotBath.jpg);
}
.music {
background:url(hothotSex.jpg);
}
.music {
background:url(backRub.jpg);
}
.music a:link {
font-weight: bold;
text-decoration: blink; !important
}
body #drugs .music {
font-weight: bolder; !important
}
body #junks .music {
font-weight: bolder; !important
}
body #boys .music {
font-weight: bolder; !important
}
body #ladies .music {
font-weight: bolder; !important
}
.music {
background:url(boyfriend.jpg);
}
.music {
background:url(girlfriend.jpg);
}
.music {
background:url(deadEnd.jpg);
}
.music {
background:url(imaginaryFriend.jpg);
}
.music {
background:url(brother.jpg);
}
.music {
background:url(greatGranddaughter.jpg);
}
.music {
background:url(sister.jpg);
}
.music {
background:url(favoriteMistress.jpg);
}
table #shit .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
table #jobs .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
table #drinks .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
table #bitches .music {
display:block;
background-color:#FF0000;
font-weight:bold;
}
.music {
background:url(beachHouse.jpg);
}
.music {
background:url(homeTown.jpg);
}
.music {
background:url(kingsizeBed.jpg);
}
.music {
background:url(meetMyFriends.jpg);
}
.music {
background:url(hotHotBath.jpg);
}
.music {
background:url(hothotSex.jpg);
}
.music {
background:url(backRub.jpg);
}
.music a:link {
font-weight: bold;
text-decoration: blink; !important
}
The original lyrics for the portion I've converted above, for your reference, is here:
From all the drugs the one i like more is music
From all the
junks the one i need more is music
From all the boys the
one i take home is music
From all the ladies the one i kiss
is music .. muach!
Music is my boyfriend
Music is my girlfriend
Music is my dead end
Music’s my imaginary friend
Music is my brother
Music is my great-grand-daughter
Music is my sister
Music is my favorite mistress
From all the shit the one I gotta buy is music
From all the jobs the one i choose is music
From all the drinks i get drunk off music
From all the bitches the one I wannabe is music
Music is my beach house
Music is my hometown
Music is my king size bed
Music’s where I meet my friends
Music is my hot hot bath
Music is my hot hot sex
Music is my back rub
My music is where I’d like you to touch
Labels: addChildsPlay, code story, css
Wednesday, October 12, 2011
Code Story: Three Blind Mice
For today's geeky story time I present the tale of THREE BLIND MICE (as told in AS3). But first, here's the original tale (tail!) as a recap:
And now dramatically interpreted in code:
Here's what it looks like in Flash (if that's easier for you to read):

And here it is with some explanations:

Three blind mice, three blind mice
see how they run, see how they run
they all ran after the farmer's wife
who cut off their tails with a carving knife.
Did you ever see such a thing in your life
as three blind mice?
And now dramatically interpreted in code:
import com.characters.FieldMouse;
import com.characters.FarmersWife;
var mice:Array = new Array();
var farmersWife_mc:FarmersWife = new FarmersWife();
addChild(farmersWife_mc);
FarmersWife.run = function():void
{
//trace("running");
}
FieldMouse.run = function()
{
trace("running");
}
for(var i:int=0; i < 3; i++)
{
var theMouse:FieldMouse = new FieldMouse();
var tail:MovieClip = new MovieClip();
theMouse.addChild(tail);
theMouse.vision = false;
mice.push(theMouse);
}
function cut(event:MouseEvent)
{
while(var j:int=0 < mice.length)
{
carvingKnife(mice[j]);
j++;
}
farmersWife_mc.removeEventListener(MouseEvent.MOUSE_OVER);
}
function carvingKnife(mouse:MovieClip)
{
mouse.removeChild(tail_mc);
}
farmersWife_mc.addEventListener(MouseEvent.MOUSE_OVER, cut);
farmersWife_mc.run();
while(var k:int=0 < mice.length)
{
Mice[j].run();
k++;
}
import com.characters.FarmersWife;
var mice:Array = new Array();
var farmersWife_mc:FarmersWife = new FarmersWife();
addChild(farmersWife_mc);
FarmersWife.run = function():void
{
//trace("running");
}
FieldMouse.run = function()
{
trace("running");
}
for(var i:int=0; i < 3; i++)
{
var theMouse:FieldMouse = new FieldMouse();
var tail:MovieClip = new MovieClip();
theMouse.addChild(tail);
theMouse.vision = false;
mice.push(theMouse);
}
function cut(event:MouseEvent)
{
while(var j:int=0 < mice.length)
{
carvingKnife(mice[j]);
j++;
}
farmersWife_mc.removeEventListener(MouseEvent.MOUSE_OVER);
}
function carvingKnife(mouse:MovieClip)
{
mouse.removeChild(tail_mc);
}
farmersWife_mc.addEventListener(MouseEvent.MOUSE_OVER, cut);
farmersWife_mc.run();
while(var k:int=0 < mice.length)
{
Mice[j].run();
k++;
}
Here's what it looks like in Flash (if that's easier for you to read):

And here it is with some explanations:

Labels: actionscript3, code story, flash, three blind mice
Sunday, August 7, 2011
Snow White and the Seven Dwarves (in AS3)
var maiden:Princess = new Princess();
var queen:Villain = new Villain();
var cabinDwellers:Array = new Array();
maiden.skin = 0xFFFFFF;
maiden.hair = 0x000000;
maiden.kryptonite = apple;
maiden.energy = 100;
maiden.living = true;
maiden.mode = "wishing and hoping";
var hagMode:Boolean = false;
queen.happy = true;
queen.appearance = hagMode;
var fairest:Boolean;
var initial:Boolean = true;
function checkFairest():Boolean
{
if(maiden.living == true)
{
fairest = false;
} else {
fairest = true;
}
return fairest;
}
function checkMirror():Void
{
var mirrorAnswer:Boolean = checkFairest();
if(fairest == true)
{
queen.happy = true;
if(hagMode == true)
{
hagMode = false;
}
} else {
queen.happy = false;
if(initial)
{
var hunter:Weapon = new Weapon();
killMaiden(hunter);
initial = false;
} else {
hagMode = true;
queen.appearance = hagMode;
var apple:Weapon = new Weapon();
killMaiden(apple);
}
}
}
function killMaiden(method:Weapon):Void
{
if(method != maiden.kryptonite)
{
maiden.direction("into the woods");
for(i:int = 0; i < 7; i++)
{
var dwarf:Dwarf = new Dwarf();
cabinDwellers.push(dwarf);
}
sendToWork(cabinDwellers);
checkMirror();
} else {
if(cabinDwellers.length <= 0)
{
maiden.energy = 0;
maiden.living = true;
maiden.mode = "waiting for the one she loves";
}
}
}
function sendToWork(workers:Array):Void
{
for(i:int = 0; i < workers.length; i++)
{
worker:Dwarf = workers.pop();
worker.whistling = true;
}
}
checkMirror();
var queen:Villain = new Villain();
var cabinDwellers:Array = new Array();
maiden.skin = 0xFFFFFF;
maiden.hair = 0x000000;
maiden.kryptonite = apple;
maiden.energy = 100;
maiden.living = true;
maiden.mode = "wishing and hoping";
var hagMode:Boolean = false;
queen.happy = true;
queen.appearance = hagMode;
var fairest:Boolean;
var initial:Boolean = true;
function checkFairest():Boolean
{
if(maiden.living == true)
{
fairest = false;
} else {
fairest = true;
}
return fairest;
}
function checkMirror():Void
{
var mirrorAnswer:Boolean = checkFairest();
if(fairest == true)
{
queen.happy = true;
if(hagMode == true)
{
hagMode = false;
}
} else {
queen.happy = false;
if(initial)
{
var hunter:Weapon = new Weapon();
killMaiden(hunter);
initial = false;
} else {
hagMode = true;
queen.appearance = hagMode;
var apple:Weapon = new Weapon();
killMaiden(apple);
}
}
}
function killMaiden(method:Weapon):Void
{
if(method != maiden.kryptonite)
{
maiden.direction("into the woods");
for(i:int = 0; i < 7; i++)
{
var dwarf:Dwarf = new Dwarf();
cabinDwellers.push(dwarf);
}
sendToWork(cabinDwellers);
checkMirror();
} else {
if(cabinDwellers.length <= 0)
{
maiden.energy = 0;
maiden.living = true;
maiden.mode = "waiting for the one she loves";
}
}
}
function sendToWork(workers:Array):Void
{
for(i:int = 0; i < workers.length; i++)
{
worker:Dwarf = workers.pop();
worker.whistling = true;
}
}
checkMirror();
Labels: actionscript3, addChildsPlay, code, code story