forked from jschr/textillate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
204 lines (183 loc) · 8.01 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE HTML>
<html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Textillate.js</title>
<link href="assets/animate.css" rel="stylesheet">
<link href="assets/style.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
<body>
<!--<a href="https://github.com/jschr/textillate"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>-->
<div class="decal"></div>
<div class="jumbotron">
<div class="container">
<h1 class="glow in tlt">textillate.js</h1>
<p class="tlt" data-in-effect="bounceInDown">
A simple plugin for CSS3 text animations.
</p>
<a href="https://github.com/jschr/textillate" class="btn fade in">Download on Github</a>
</div>
</div>
<div class="decal"></div>
<div class="container fade in">
<div class="about">
<div class="grid grid-pad">
<section class="col-1-3">
<h2>About</h2>
<p>Textillate.js combines some awesome libraries to provide a ease-to-use plugin for applying CSS3 animations to any text.</p>
</section>
<section class="col-1-3">
<h2>Usage</h2>
<p>Simply include textillate.js and it's dependencies in your project to start creating unqiue effects.</p>
</section>
<section class="col-1-3">
<h2>Credits</h2>
<p>Textillate.js is built on top of the simple, yet amazingly powerful <a href="http://daneden.me/animate">animate.css</a> and <a href="http://letteringjs.com">lettering.js</a> libraries.</p>
</section>
</div>
</div>
<!--<div class="grid grid-pad">
<section class="col-1-1">
<h2>Examples</h2>
<pre><code class="xml"><span id="example">Some Text</span></code></pre>
<pre><code class="javascript">$('#example').textillate()</code></pre>
</section>
</div>-->
<div class="grid grid-pad">
<section class="col-1-1">
<h2>Playground</h2>
<div class="playground grid">
<div class="col-1-1 viewport">
<div class="tlt">
<ul class="texts" style="display: none">
<li>Grumpy wizards make toxic brew for the evil Queen and Jack.</li>
<li>The quick brown fox jumps over the lazy dog.</li>
</ul>
</div>
</div>
<div class="col-1-1 controls" style="padding-right: 0">
<form class="grid grid-pad">
<div class="control col-1-2">
<label>In Animation</label>
<select data-key="effect" data-type="in"></select>
<select data-key="type" data-type="in">
<option value="">sequence</option>
<option value="reverse">reverse</option>
<option value="sync">sync</option>
<option value="shuffle">shuffle</option>
</select>
</div>
<div class="control col-1-2">
<label>Out Animation</label>
<select data-key="effect" data-type="out"></select>
<select data-key="type" data-type="out">
<option value="">sequence</option>
<option value="reverse">reverse</option>
<option value="sync">sync</option>
<option selected="selected" value="shuffle">shuffle</option>
</select>
</div>
</form>
</div>
</div>
</section>
</div>
<div class="grid grid-pad">
<section class="col-1-1 deps">
<h2>Dependencies</h2>
<p>Textillate.js depends on the following libraries: </p>
<div>
<ul>
<li><a href="http://jquery.com/">jQuery</a></li>
<li><a href="http://daneden.me/animate/">animate.css</a>, by Daniel Eden</li>
<li><a href="http://letteringjs.com/">lettering.js</a>, by Dave Rupert</li>
</ul>
</div>
</section>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="assets/jquery.fittext.js"></script>
<script src="assets/jquery.lettering.js"></script>
<script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
<script src="jquery.textillate.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script>
$(function (){
var log = function (msg) {
return function () {
if (console) console.log(msg);
}
}
$('code').each(function () {
var $this = $(this);
$this.text($this.html());
})
var animateClasses = 'flash bounce shake tada swing wobble pulse flip flipInX flipOutX flipInY flipOutY fadeIn fadeInUp fadeInDown fadeInLeft fadeInRight fadeInUpBig fadeInDownBig fadeInLeftBig fadeInRightBig fadeOut fadeOutUp fadeOutDown fadeOutLeft fadeOutRight fadeOutUpBig fadeOutDownBig fadeOutLeftBig fadeOutRightBig bounceIn bounceInDown bounceInUp bounceInLeft bounceInRight bounceOut bounceOutDown bounceOutUp bounceOutLeft bounceOutRight rotateIn rotateInDownLeft rotateInDownRight rotateInUpLeft rotateInUpRight rotateOut rotateOutDownLeft rotateOutDownRight rotateOutUpLeft rotateOutUpRight hinge rollIn rollOut';
var $form = $('.playground form')
, $viewport = $('.playground .viewport');
var getFormData = function () {
var data = {
loop: true,
in: { callback: log('in callback called.') },
out: { callback: log('out callback called.') }
};
$form.find('[data-key="effect"]').each(function () {
var $this = $(this)
, key = $this.data('key')
, type = $this.data('type');
data[type][key] = $this.val();
});
$form.find('[data-key="type"]').each(function () {
var $this = $(this)
, key = $this.data('key')
, type = $this.data('type')
, val = $this.val();
data[type].shuffle = (val === 'shuffle');
data[type].reverse = (val === 'reverse');
data[type].sync = (val === 'sync');
});
return data;
};
$.each(animateClasses.split(' '), function (i, value) {
var type = '[data-type]'
, option = '<option value="' + value + '">' + value + '</option>';
if (/Out/.test(value) || value === 'hinge') {
type = '[data-type="out"]';
} else if (/In/.test(value)) {
type = '[data-type="in"]';
}
if (type) {
$form.find('[data-key="effect"]' + type).append(option);
}
});
$form.find('[data-key="effect"][data-type="in"]').val('fadeInLeftBig');
$form.find('[data-key="effect"][data-type="out"]').val('hinge');
$('.jumbotron h1')
.fitText(0.5)
.textillate({ in: { effect: 'flipInY' }});
$('.jumbotron p')
.fitText(3.2, { maxFontSize: 18 })
.textillate({ initialDelay: 1000, in: { delay: 3, shuffle: true } });
setTimeout(function () {
$('.fade').addClass('in');
}, 250);
setTimeout(function () {
$('h1.glow').removeClass('in');
}, 2000);
var $tlt = $viewport.find('.tlt')
.on('start.tlt', log('start.tlt triggered.'))
.on('inAnimationBegin.tlt', log('inAnimationBegin.tlt triggered.'))
.on('inAnimationEnd.tlt', log('inAnimationEnd.tlt triggered.'))
.on('outAnimationBegin.tlt', log('outAnimationBegin.tlt triggered.'))
.on('outAnimationEnd.tlt', log('outAnimationEnd.tlt triggered.'))
.on('end.tlt', log('end.tlt'));
$form.on('change', function () {
var obj = getFormData();
$tlt.textillate(obj);
}).trigger('change');
});
</script>
</body>
</html>