Created
September 9, 2011 16:24
-
-
Save gferreira/1206663 to your computer and use it in GitHub Desktop.
Elementar jQuery plugin [DRAFT]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Elementar jQuery plugin [DRAFT] */ | |
// use Elementar fonts via Typotheque's web font system | |
// args: family name, style name, webfont key | |
$('.myClass').eFont('Sans A', '13 21 2', 'WF-XXXXXX-XXXXX') | |
// use self-hosted fonts | |
// args: family name, style name, path to fonts folder | |
$('.myClass').eFont('Sans A', '13 21 2', '../fonts/') | |
// get current height (as a number, not string) | |
$('.myClass').eFont.height | |
// set current width, as a number: | |
// plugin does conversion internally, | |
// and updates text to resulting font | |
$('.myClass').eFont.width = 3 | |
// increase width numerically | |
$('.myClass').eFont.width += 1 | |
// increase stroke weights individually | |
$('.myClass').eFont.weight += 1 // horizontal (n) | |
$('.myClass').eFont.weight += 10 // vertical (n * 10) | |
// separate attributes for vert./horiz. strokes (?) | |
$('.myClass').eFont.vstroke += 1 | |
$('.myClass').eFont.hstroke += 1 | |
// logic for simple animation: | |
// change height from 7 to 13px | |
for (ht=7; ht<=13; ht++) { | |
$('.myClass').eFont.height = ht; | |
} | |
/* eFont animation API [DRAFT] */ | |
$('.mySample').eFont.animate(event, { parameter : (start, end) } ) | |
/* example : interactive interface */ | |
// on 'page load': | |
// animate text objects from 1 to 7px in height | |
$('.mySample').eFont.animate('load', { 'height' : (1, 7) } ) | |
// on 'mouse over' the text object: | |
// animate height from 7 to 13px | |
$('.mySample').eFont.animate('mouseover', { 'height' : (7, 13) } ) | |
// on 'mouse out' from the text object: | |
// animate height back from from 7 to 13px | |
$('.mySample').eFont.animate('mouseout', { 'height' : (13, 7) } ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment