-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
138 lines (107 loc) · 3.77 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Gif Scratcher</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href='https://fonts.googleapis.com/css?family=Gentium+Basic:400,700&subset=latin' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="stylesheets/style.css">
<link rel="stylesheet" href="stylesheets/gifscratcher.css">
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
</head>
<body>
<div class="page">
<header>
<h1 class="headline">Gif Scratcher</h1>
<p class="tagline">
A lightweight (~4kb minified) jQuery plugin that allows you to scratch GIFs.
</p>
<a href="https://github.com/linuslundahl/GifScratcher/archive/master.zip" class="button">Download</a> <a href="https://github.com/linuslundahl/GifScratcher" class="button">GitHub</a>
</header>
<section>
<h2>Demo</h2>
<div id="animation-1" class="target">
<img src="http://compost.unwi.se/github/animations/1/00.jpg">
</div>
Move your mouse over the GIF to scratch it. (GIF by <a href="http://juliendouvier.tumblr.com">Julien Douvier</a>)
</section>
<section>
<h2>Documentation</h2>
<p>
Add the first image in your animation to your HTML file.
</p>
<code>
<pre><div id="target" class="target">
<img src="animation-first.jpg">
</div></pre>
</code>
<p>
Then add the jQuery magic.
</p>
<code>
<pre>$("#target").gifscratcher({
sprite : 'animation.jpg',
frames : 10
});</pre>
</code>
<p>
Settings available.
</p>
<code>
<pre>{
sprite : string // Image sprite
frames : int // Number of frames in sprite
interaction : string // 'hover'
// 'drag'
auto : boolean // Autoplay
speed : int // Autoplay speed
cursor : boolean // Add custom cursor
}</pre>
</code>
</section>
<section>
<h2>Help</h2>
<p>
To extract every single frame from an animated GIF as individual JPEGs and create a sprite you can use ImageMagick in the terminal.
</p>
<p>
Install ImageMagick (OS X):
<span class="command">brew install imagemagick</span>
</p>
<p>
To extract the frames run:
<span class="command">convert FILENAME.gif -coalesce %02d.jpg</span>
</p>
<p>
To create the sprite run:
<span class="command">montage `ls ??.jpg` -tile NUMBER_OF_FRAMESx1 -geometry 500x284 FILENAME.jpg</span>
</p>
</section>
<footer>
<div class="about">
Brought to you by <a href="http://unwi.se/">http://unwi.se/</a>.
</div>
<div class="twitter-share share"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://<?php print $_SERVER['HTTP_HOST']; ?>" data-via="linuslundahl">Tweet</a></div>
</footer>
</div>
<script src="javascripts/gifscratcher.js" defer></script>
<script defer>
;(function ($) {
'use strict';
$(function() {
var path = 'http://compost.unwi.se/github/animations/';
$("#animation-1").gifscratcher({
sprite : path + '1.jpg',
frames : 26,
interaction : 'hover',
auto : true,
speed : 4
});
// Twitter
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
});
})(jQuery);
</script>
</body>
</html>