Starting point for standard (IAB, Atlas, DCM) banners using Greensock as tween engine, Gulp to process assets.
This template is designed to solve some recurring problems with banner development. Here's a few features:
- Eliminates nearly all pixel positioning of assets by using png transparency.
- Eliminates duplicative addressing of assets, dom elements and classes.
- Automatically optimizes, trims, and URI encodes images.
- Allows for nearly no changes to basic timeline animations from size to size.
- Allows for 1x and 2x assets for retina / non-retina screens.
Here's the basics on how to use:
- Make sure you have gulp and npm installed. Run npm install to make sure you have all dependencies.
- Duplicate any assets that aren't full bleed into pngs the size of the banner stage. Don't bother cutting line-by-line for stacks of copy.
- For most assets, double the size for retina. If the asset is problematic for retina (some thin text, or a low-res original) leave 1x.
- Name each file according to how you want to address it in your javascript. For any 1x assets, append '_1x' to the name.
- All assets should be placed in the assets/ folder.
- Run gulp. src//assets.js file will be updated with URI encoded contents of assets folder.
- Instantiate assets using several utility functions designed to quickly generate sprites.
- Animate using TimelineLite.
File Structure:
+ assets
- <size>
| <all image files to be processed by gulp>
+ src
- <size>
| index.html (should only contain:
| basic markup describing containers,
| an onload function,
| the clicktag implementation,
| metatag declaring banner size)
| main.js (your code here)
| utils.js (functions for generating sprites, helpers, &c.)
| assets.js (gulp generated file with an object for each encoded asset)
gulpfile.js (asset processing)
package.json (npm dependencies)
.gitignore (for anything you'd like to ignore, possibly including assets.js)