theChrisWalker.net

“Linux Mint advocate”

says Chris

QR Code for Permalink
More WebKit Goodies – CSS Transforms and Transitions – the OSX Dock example

with 2 comments

As promised last time, I here we will discuss the transforms in WebKit, and how they can be used to create interactive applications without Javascript (for animation that is – we still need it for AJAX, etc.)

Tranforms have been implemented on a few browser using proprietary syntax, and the same is true of WebKit. As we shall see further down the article though, the WebKit transitions make them so much more powerful.

But what are they? They modify an element, without displacing it’s original setting within the document, which means we can move it about and the spacing doesn’t change.

Remember these will only work in WebKit based browsers, for example Safari for Mac, Chrome for Windows or Midori for Linux

An example: how about rotation.

element:hover {
  -webkit-transform:rotate(180deg);
}

Not very exciting, but combine this with a transition! (Try putting you mouse in the middle of the box for best effect)

element:hover {
  -webkit-transform:rotate(180deg);
}
element {
  -webkit-transition:-webkit-transform 1s linear
}

Read the rest of this entry »

Written by Chris

March 12th, 2009 at 7:44 pm

Posted in Code

Tagged with ,

QR Code for Permalink
Webkit CSS Transitions – pretty cool stuff

with 3 comments

I recently read somewhere about developing web applications for the iPhone / Android browsers that you shouldn’t use Javascript Frameworks (e.g. jQuery) for animation in your web apps but instead use CSS3 transitions. I had no idea what these where, so had to look it up. Turns out it’s pretty much a WebKit only thing, but that’s fine for iPhone (Safari) and Android (Chrome) Browsers.

But what is it? Simply put, it’s a way to create a transition between to CSS states (hope that cleared everything up for you!)

Better, an example: You have two CSS rules for an element, say a link, and for it’s :hover state. like this:

a {
    background:#eee;
    color:#333;
    text-decoration:none;
    padding:5px 10px;
    border:2px solid #333;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
}
a:hover {
    background:#333;
    color:#eee;
}

Now usually, the browser would switch instantly between these two states, but with transitions we can slow it down into a smooth animation.

We can specify which propertys to transition and which to allow to change instantly. Here we can transition in the background and color properties.

a {
    background:#eee;
    color:#333;
    text-decoration:none;
    padding:5px 10px;
    border:2px solid #333;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
     
    /* Add the transition properties! */
    -webkit-transition-property: background-color, color;
    -webkit-transition-duration: 600ms;
    /* you can control the acceleration curve here */
    -webkit-transition-timing-function: ease-in-out;
}
a:hover {
    background:#333;
    color:#eee;
}

Here’s two links, the they are identical except that the second has the transisions applied and if you’re using a WebKit based browser then it will fade nicely between states.

I will flick between states. Do I fade or do I flick?

Next time I’ll go into a bit more detail and show how using CSS Transforms as well we can make an OSX Dock style menu using CSS alone!

Written by Chris

March 10th, 2009 at 10:11 pm

Posted in Code

Tagged with ,

QR Code for Permalink
Discovering QR Codes

with 2 comments

I recently discovered QR codes and how cool they are! Basically it’s a 2-D barcode and can store much more information than your standard bar code.
A QR code is a square of dots in a certain computer-readable pattern, for example there is one to the top-left of this post, encoded with the URL to this post.

Why bother though? Well, they are used mostly in Japan, where mobile phones are generally all Internet-enabled, so on an advert you might have a QR code for a URL where more info can be found. So you whip out your phone, point the in-built camera at the code, and bingo, it takes you to the website. Also you could have a film opening encoded in QR as a calendar event, so when you scan it it puts a reminder in your calendar. Useful no?

On a personal level though, when QR codes are not big in England, why should I care. Well, they are useful for transferring information I want to a phone. For example, I have a bookmarklet on my browser that converts the current page I’m looking at into a QR code (courtesy of the Google Chart API) and open the image in a new tab. Very useful if I find a page and think, “I’ll want to look at that later” I can make the QR scan it with my phone, and the page goes into it’s browser history for my later enjoyment.

For those of you interested the bookmarklet code is (should be all on one line, but for the page width’s sake…):

javascript:(function(){window.open(
  'http://chart.apis.google.com/chart?cht=qr&chs=400x400&chl='+
  encodeURIComponent(window.location.href)
);})()

Try it! (will generate the QR code for this page, but a lot bigger than the one by the title)

You may have noticed that there are QR codes for the permalinks to these posts aswell, so you can easily bookmark them with a capable phone. Another useful function that my phone can do is to display the QR code for a Contact in my address book, so I can easily share that with another QR enabled phone without having to “pair” them with bluetooth, or use Infrared (if the phone still has it!) or text it or whatever. Much more convenient. I just need to find someone else with a QR enabled phone…

Written by Chris

February 18th, 2009 at 3:32 pm

Posted in Not Code

Tagged with ,

QR Code for Permalink
The T-Mobile Google G1

without comments

So I decided the time had come to get a smartphone. There’s only really two options the way I see it.

In the red corner, the slick-as-you-like, shiny, fashionable, Apple iPhone.

In the blue corner, the open-source, all-your-data-are-belong-to-us, Google G1.

I’ll save the theatrics as you know from the title that I went for the G1. But the pros-cons weighting was a difficult process with many factors. However me being me, the main one and the one that rules them all was price in the end. So lets make this all about the Google G1, and in order to falsely encourage you to thinks it’s great I’ll start with the cons.

Read the rest of this entry »

Written by Chris

February 13th, 2009 at 5:44 pm

Posted in Not Code

Tagged with , ,

QR Code for Permalink
Multiple Drag and Drop between two lists with jQuery

with 98 comments

I wanted this functionality for a project a while ago. I google’d and found that lots of others did too, but no one had done it. Or at least not in a way that I could understand. In fact, I’m not sure I completely understand it anymore. It works very well, but also it could have some improvement. I would like to be able to drag the mouse to create a selection, but this in itself poses the difficultly of how to distinguish a “drag-to-move” from a “drag-to-select”.

Still I found it an interesting proof-of-concept and maybe you will too. The test can be found here: Select and Drag Demo.

Written by Chris

February 10th, 2009 at 12:26 pm

Posted in Code

Tagged with ,