EVR.Pop_Up.Veil = function(container)
{
   EVR.Graphic.call(this, container);
   this.set_attributes();
   this.append();
}
EVR.Pop_Up.Veil.prototype = new EVR.Graphic;
EVR.Pop_Up.Veil.prototype.set_attributes = function()
{
   this.set_proportions(1, 1);
   this.set_z(POP_UP_VEIL_Z_INDEX);
   this.set_color(POP_UP_VEIL_COLOR);
   this.set_opacity(POP_UP_VEIL_OPACITY);
}
EVR.Pop_Up.Veil.prototype.toString = function()
{
   return "[object EVR.Pop_Up.Veil]";
}
EVR.include("element/pop_up/Veil.js");
EVR.Pop_Up = function(container, width, height)
{
   EVR.Graphic.call(this, container, null, null, ALIGN_CENTER);
   this.width = width;
   this.height = height;
   this.set_attributes();
   this.add_focus_receiver();
}
EVR.Pop_Up.prototype = new EVR.Graphic;
EVR.Pop_Up.prototype.set_attributes = function()
{
   this.set_proportions(this.width, this.height);
   this.set_z(POP_UP_WINDOW_Z_INDEX);
   var css = this.css;
   css.overflow = "auto";
   css.border = POP_UP_BORDER;
}
EVR.Pop_Up.prototype.add_focus_receiver = function()
{
   var link = document.createElement("a");
   link.href = "javascript: void(0)";
   this.element.appendChild(link);
   this.focus_receiver = link;
}
EVR.Pop_Up.prototype.draw = function()
{
   !!this.veil && this.veil.draw();
   EVR.Graphic.prototype.draw.call(this);
}
EVR.Pop_Up.prototype.append = function()
{
   EVR.Graphic.prototype.append.call(this);
   var link = this.focus_receiver;
   setTimeout(function() { link.focus() }, 50);
   this.veil = new EVR.Pop_Up.Veil(this.container);
}
EVR.Pop_Up.prototype.remove = function()
{
   EVR.Graphic.prototype.remove.call(this);
   this.veil.remove();
   this.veil = null;
}
EVR.Pop_Up.prototype.toString = function()
{
   return "[object EVR.Pop_Up]";
}
EVR.include("time/Translator.js");
EVR.Time = function(time)
{
   this.translator = new EVR.Time.Translator(time);
}
EVR.Time.prototype.add = function(time)
{
   this.translator.add(time);
}
EVR.Time.prototype.get = function()
{
   return this.translator.get();
}
EVR.Time.prototype.get_formatted = function(precision, padding)
{
   if (precision == null)
   {
      precision = CLOCK_PRECISION;
   }
   if (padding == null)
   {
      padding = CLOCK_PADDING;
   }
   var m = this.pad(this.get_minutes(), padding);
   var s = this.pad(this.get_seconds() % 60, 2);
   var string = m + ":" + s;
   if (precision > 0)
   {
      var ms = this.pad(this.get_milliseconds(precision), precision);
      string += "." + ms;
   }
   return string;
}
EVR.Time.prototype.get_milliseconds = function(precision)
{
   if (precision == null)
   {
      precision = 3;
   }
   return parseInt(this.get() % 1000 / (1000 / Math.pow(10, precision)));
}
EVR.Time.prototype.get_seconds = function()
{
   return parseInt(this.get() / 1000);
}
EVR.Time.prototype.get_minutes = function()
{
   return parseInt(this.get_seconds() / 60);
}
EVR.Time.prototype.pad = function(number, length)
{
   length -= number.toString().length;
   return new Array(length + 1).join("0") + number;
}
EVR.Time.prototype.toString = function(precision, padding)
{
   return this.get_formatted(precision, padding);
}
EVR.Time.Translator = function(time)
{
   this.time = this.convert(time) || 0;
}
EVR.Time.Translator.prototype.convert = function(time)
{
   if (!this.is_timestamp(time))
   {
      time = this.extract_timestamp(time);
   }
   return time;
}
EVR.Time.Translator.prototype.is_timestamp = function(time)
{
   return !/\./.test(time);
}
EVR.Time.Translator.prototype.extract_timestamp = function(time)
{
   var fields = time.match(/(.{1,2})\.(.{3})/);
   var timestamp = parseInt(fields[2], 10) + parseInt(fields[1], 10) * 1000;
   if (fields = time.match(/(.*):/))
   {
      timestamp += fields[1] * 60 * 1000;
   }
   return timestamp;
}
EVR.Time.Translator.prototype.get = function()
{
   return parseInt(this.time);
}
EVR.Time.Translator.prototype.add = function(time)
{
   this.time += this.convert(time);
}
EVR.Time.Translator.prototype.toString = function()
{
   return "[EVR.Time.Translator]";
}
EVR.Instructions = function(container)
{
   EVR.Pop_Up.call(this, container, INSTRUCTIONS_WIDTH, INSTRUCTIONS_HEIGHT);
   this.set_attributes();
   this.add_focus_receiver();
   this.include_document();
}
EVR.Instructions.prototype = new EVR.Pop_Up;
EVR.Instructions.prototype.set_attributes = function()
{
   EVR.Pop_Up.prototype.set_attributes.call(this);
   this.set_color(INSTRUCTIONS_BACKGROUND);
   var css = this.css;
   css.fontSize = INSTRUCTIONS_FONT_SIZE;
   css.fontFamily = INSTRUCTIONS_FONT_FAMILY;
   css.color = INSTRUCTIONS_FONT_COLOR;
   css.letterSpacing = INSTRUCTIONS_LETTER_SPACING;
   css.lineHeight = INSTRUCTIONS_LINE_HEIGHT;
   css.padding = INSTRUCTIONS_PADDING;
}
EVR.Instructions.prototype.include_document = function()
{
   var path = SOURCE_PATH + "instructions/instructions";
   var document = new EVR.Requester(path, null, true).execute().split("\n\n");
   this.translate_document(document);
}
EVR.Instructions.prototype.translate_document = function(document)
{
   var line;
   for (var ii = 0; ii < document.length; ii++)
   {
      line = document[ii];
      if (/^img\//.test(line))
      {
	 this.add_image(line);
	 continue;
      }
      this.add_paragraph(line);
   }
}
EVR.Instructions.prototype.add_image = function(src)
{
   var element = document.createElement("img");
   element.src = src;
   element.style.display = "block";
   element.style.margin = INSTRUCTIONS_IMAGE_MARGIN + " auto";
   this.element.appendChild(element);
}
EVR.Instructions.prototype.add_paragraph = function(text)
{
   var element = document.createElement("p");
   var style = element.style;
   element.innerHTML = text;
   style.textAlign = INSTRUCTIONS_PARAGRAPH_TEXT_ALIGN;
   style.background = INSTRUCTIONS_PARAGRAPH_BACKGROUND;
   style.padding = INSTRUCTIONS_PARAGRAPH_PADDING;
   this.element.appendChild(element);
}
EVR.Instructions.prototype.toString = function()
{
   return "[object EVR.Instructions]";
}
3.144.31.86
3.144.31.86
3.144.31.86
 
August 12, 2013

I've been researching tartan/plaid recently for decoration in my updated version of Ball & Cup, now called Send. I want to create the atmosphere of a sports event, so I plan on drawing tartan patterns at the vertical edges of the screen as backgrounds for areas where spectator ants generate based on player performance. I figured I would make my own patterns, but after browsing tartans available in the official register, I decided to use existing ones instead.

I made a list of the tartans that had what I thought were interesting titles and chose 30 to base the game's levels on. I sequenced them, using their titles to form a loose narrative related to the concept of sending. Here are three tartans in the sequence (levels 6, 7 and 8) generated by an algorithm I inferred by looking at examples that reads a tartan specification and draws its pattern using a simple dithering technique to blend the color stripes.


Acadia


Eve


Spice Apple

It would be wasting an opportunity if I didn't animate the tartans, so I'm thinking about animations for them. One effect I want to try is making them look like water washing over the area where the ants are spectating. I've also recorded some music for the game. Here are the loops for the game over and high scores screens.

Game Over

High Scores