Friday, June 28, 2013

Hello World - Blinking neon sign/Typing on screen

While I didn't follow the transition idea literally, I did go beyond it using a bit of code-fu.

I find it particularly enjoyable when you can get programming to simulate real-world stuff, even more so when it doesn't require a great deal of slaving away to do so. Enter the neon sign. There are several types of neon signs out there to choose from: the old diner sign, the old hotel sign, the 80s cocktail sign. I went with the old hotel sort of sign, but I dressed it up in a fancier font.

You have access to just about any font on the web these days, and you can import whatever font you like through CSS's @import command. Next I centered the "container", which I didn't ID as such (standard practice is <div id="container">), since I was only using one div to hold the text.

The "glow" in CSS is actually defined as a text-shadow. In CSS, text-shadow does glows and shadows depending on the colors you choose.

Now, the interesting part for me is the flickering. What it is, essentially, is enumerating the letters on the screen, picking a random one, and then toggling an "off" class in rapid succession (30ms intervals). The amount of times it actually flickers is defined in an array of odd numbers, which are randomly chosen.

check it out here

---
The second example I have is more of a meta-imitation, a simulation of typing on the screen. This one didn't really require coding at all, but I threw in a little jquery just for dramatic purposes. Since jQuery minimized is only about 4k, I don't think it's an egregious offense to include it.

Anyway, the magic done in this one is by using @keyframes. I set the original width to 0%, and from there expands to the width declared for the h1 selector. The blinking caret continues indefinitely switching between  transparent and black. The caret itself is actually just part of a text-border called as "border-right". If you delete the "-right" part, then it becomes a whole box around the text that blinks.

check this one out here.


Thursday, June 27, 2013

Lesson 1: Hello World

Welcome to our blog on HTML5 and Javascript. We started this blog together to collaborate online to learn HTML5 and to motivate others by sharing our projects. We shall be presenting challenges focusing on learning to program from the very beginning levels. As we complete these challenges we will post our own solutions so we can share the knowledge and learn from each other.

Our first challenge is to create a transition using CSS3 to write the phrase "Hello World". There are no strict guidelines; make it as simple or elaborate as you like. Just be sure you are using at least one CSS3 transition. Here's a link on transitions to get you started: http://www.w3schools.com/css3/css3_transitions.asp