<commit_before># flippy framey

Efficiently load and display images in the classic flipbook style.

## Description

We wanted to be able to build web pages that featured animations in the classic [flipbook style](https://www.youtube.com/watch?v=UocF4ycBnYE) which could be driven by [scroll position](https://github.com/WilliamsNY/rolly-scrolly), or feasibly some other incrementor/decrementor.

You can see an example [here](http://williamsny.github.io/flippy-framey/).

## Features

* Animates through a set of images by rendering them on an HTML5 canvas
* Loads lower quality images and upgrades to high quality versions if the animation is paused

## Usage

This library exports a single function, `flippyFramey`. It takes a single argument, an object of configuration options.

The function assumes:

* you have a canvas somewhere on the page
* you have at least one sets of images and no more than two (low and high quality)
* your images are hosted somewhere, and:
  * your image sets follow a consistent naming scheme
  * your image sets have consistent sizes (identical pixel measurements)

Below you'll find an example of how you can call the `flippyFramey` function. This example passes the options that would be used by default anyway, so any configuration attributes that suit your purposes can be omitted at your discretion.

```Javascript
// there are no sensible defaults for these values
// just define them outside of the function call and pass them in
var thumbs={
    width:960,
    height:540,
    scheme:function(index){
        return 'http://your.content.distribution.network/and/naming/scheme/thumbs/image_'+index;
    },
    index:0,
};
var full={
    width:1920,
    height:1080,
    scheme:function(index){
        return 'http://your.content.distribution.network/and/naming/scheme/thumb/image_'+index;
    },
    index:0,
};

var flipper=flippyFramey({
    // flippyFramey will draw to the canvas with the following id
    canvas:'canvas',

    // the image index from which you'd like to start counting
    state:0,

    // passing in the details for our thumbnail image set defined above
    thumbs:thumbs,

    // passing in the details for our full quality image set defined above
    full:full,

    // the time an image must remain static before upgrading to the full quality version
    // this never gets used unless you pass an actual value to the 'full' attribute
    // 50ms is probably good
    upgradeDelay:50,

    // how many times should you try to upgrade before giving up?
    upgradeTries:10,
<commit_msg>README.md : add note on 'rate'<commit_after># flippy framey

Efficiently load and display images in the classic flipbook style.

## Description

We wanted to be able to build web pages that featured animations in the classic [flipbook style](https://www.youtube.com/watch?v=UocF4ycBnYE) which could be driven by [scroll position](https://github.com/WilliamsNY/rolly-scrolly), or feasibly some other incrementor/decrementor.

You can see an example [here](http://williamsny.github.io/flippy-framey/).

## Features

* Animates through a set of images by rendering them on an HTML5 canvas
* Loads lower quality images and upgrades to high quality versions if the animation is paused

## Usage

This library exports a single function, `flippyFramey`. It takes a single argument, an object of configuration options.

The function assumes:

* you have a canvas somewhere on the page
* you have at least one sets of images and no more than two (low and high quality)
* your images are hosted somewhere, and:
  * your image sets follow a consistent naming scheme
  * your image sets have consistent sizes (identical pixel measurements)

Below you'll find an example of how you can call the `flippyFramey` function. This example passes the options that would be used by default anyway, so any configuration attributes that suit your purposes can be omitted at your discretion.

```Javascript
// there are no sensible defaults for these values
// just define them outside of the function call and pass them in
var thumbs={
    width:960,
    height:540,
    scheme:function(index){
        return 'http://your.content.distribution.network/and/naming/scheme/thumbs/image_'+index;
    },
    index:0,
};
var full={
    width:1920,
    height:1080,
    scheme:function(index){
        return 'http://your.content.distribution.network/and/naming/scheme/thumb/image_'+index;
    },
    index:0,
};

var flipper=flippyFramey({
    // flippyFramey will draw to the canvas with the following id
    canvas:'canvas',

    // passing in the details for our thumbnail image set defined above
    thumbs:thumbs,

    // passing in the details for our full quality image set defined above
    full:full,

    // the rate at which thumbnails are fetched (1/rate)
    // default is 1 thumbnail per 50ms
    rate: 20,

    // the time an image must remain static before upgrading to the full quality version
    // this never gets used unless you pass an actual value to the 'full' attribute
    // 50ms is probably good
    upgradeDelay:50,

    // how many times should you try to upgrade before giving up?
    upgradeTries:10,

{'fraction_non_alphanumeric': 0.07213496218731821, 'fraction_numerical': 0.010665115377157261, 'mean_word_length': 3.680580762250454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7599046', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1361, 'n_words': 643}