├── .gitattributes ├── README.md ├── atvImg-min.js ├── atvImg.css ├── atvImg.js └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # atvImg 2 | 3 | `atvImg` = 'AppleTV Image' 4 | 5 | Made by http://drewwilson.com 6 | 7 | --- 8 | 9 | This lightweight (2kb) plug-in will automatically turn your layered Apple TV PNGs into 10 | 3D parallax icons, the same way the new Apple TV treats app icons. 11 | You can have any number of AppleTV Images on your web page. 12 | 13 | No dependencies, this plugin is just plain ol' vanilla javascript. Works on all 14 | major browsers. It even supports touch and mobile. 15 | 16 | atcImg example 17 | 18 | A live example of this plug-in can bee seen here: http://kloc.pm 19 | 20 | Here is a video explaining how it works: http://d.pr/v/18YXv 21 | 22 | Here is a video showing off the touch/mobile support: http://d.pr/v/1k2Ju 23 | 24 | ------------------- 25 | 26 | Here is how to setup the HTML for a single `atvImg`: 27 | ```html 28 |
29 | 30 | 31 |
32 |
33 |
34 | ``` 35 | 36 | You can have any number of `'.atvImg-layer'` elements. So add as many as your icon needs. Be sure to use 2x (retina) scale PNGs. The plug-in will downscale for 1x screens. Using 2x scale PNGs is recommended so the icon will appear crisp on 2x screens. 37 | 38 | Layer images should be 2x the size you want to display the icon as. The plug-in will adapt the `atvImg` to be whatever size it's parent element is. So if you set your `'.atvImg'` element to be 320px X 190px, that is how big the icon will appear. If you set it to be 640px X 380px, that is how big it will appear. Just be sure to use the correct aspect ratio for AppleTV icons. 39 | 40 | The `` element in the example above is a fallback in case javascript is not allowed to run. It will be removed when the plug-in is running. Put a flattened version (no layers) of you icon in there. 41 | 42 | Then call the function in you `