Web Animation using JavaScript: Develop & Design (Develop and Design)

(Joyce) #1

In addition to its robustness, Blast provides a high level of accuracy. It doesn’t dumbly
split words at spaces, nor does it split sentences at periods within words. It leverages UTF-
8 character sets for Latin alphabet languages, meaning that you can accurately apply it to
French, German, Spanish, English, Italian, and Portuguese content.


Suppose you used Blast’s sentence delimiter on the following paragraph. (Bold and
italic are used below to indicate the consecutive text matches that Blast detects.) Blast
correctly identified six sentences in the paragraph:


¿Will the sentence delimiter recognize this full sentence containing Spanish
punctuation? ¡Yes! « Mais, oui ! » “Nested “quotes” don’t break the sentence
delimiter!” Further, periods inside words (e.g. Blast.js), in formal titles (e.g. Mrs. Bluth,
Dr. Fünke), and in “e.g.” and “i.e.” do not falsely match as sentence-final punctuation.
Darn. That’s pretty impressive.


Notice how punctuation is associated with its proper sentence, and how errant periods
don’t falsely demarcate sentence matches.


With    these   foundations covered,    it’s    time    to  run through how to  use Blast.

Installation


Blast is installed on a page like any other JavaScript plugin: embed the appropriate script
link before your page’s tag:


Click here to view code image



My Page

My content.





    Note

Blast   requires    jQuery  (or Zepto,  a   jQuery  alternative),   and therefore   must    be
required after jQuery. It doesn’t matter whether Blast is loaded before or after
Velocity.

Once Blast is loaded, use it by calling .blast() on a jQuery element object. It
accepts an options object as its sole argument:


Click here to view code image
$element.blast({ option1: value1, option2: value2 });
Let’s run through the available options.

Free download pdf