Skip to content

Commit cff80d9

Browse files
author
Andrew Mahon (Type/Code)
committed
added browser checking
1 parent 42f0dd5 commit cff80d9

File tree

5 files changed

+46
-10
lines changed

5 files changed

+46
-10
lines changed

css/tc.splash.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ h1 span { display:none; }
7878
display:block;
7979
position:relative;
8080
z-index:100;
81-
8281
opacity:0;
8382
}
8483

@@ -129,3 +128,17 @@ h1 span { display:none; }
129128
left:1px;
130129
outline:0;
131130
}
131+
132+
.browser-hint{
133+
position:fixed;
134+
left:10px;
135+
bottom:10px;
136+
z-index:10000;
137+
font-size:0.8em;
138+
opacity:0;
139+
}
140+
141+
.browser-hint a{
142+
color: #6198bf;
143+
text-decoration:none;
144+
}

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ <h1><span>Type/Code</span></h1>
2525
<p>See what we’re up to on <a href="http://blog.typeslashcode.com">our blog</a></p>
2626
</div>
2727

28+
<p class='browser-hint'>This works best on Google <a href='http://www.google.com/chrome/'>Chrome</a>.</p>
29+
2830
<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.2.0/build/yui/yui-min.js&3.2.0/build/json/json-min.js&3.2.0/build/oop/oop-min.js&3.2.0/build/event-custom/event-custom-min.js&3.2.0/build/event/event-base-min.js&3.2.0/build/dom/dom-min.js&3.2.0/build/dom/dom-style-ie-min.js&3.2.0/build/pluginhost/pluginhost-min.js&3.2.0/build/node/node-min.js&3.2.0/build/event/event-delegate-min.js&3.2.0/build/querystring/querystring-stringify-simple-min.js&3.2.0/build/queue-promote/queue-promote-min.js&3.2.0/build/datatype/datatype-xml-min.js&3.2.0/build/io/io-min.js&3.2.0/build/event-simulate/event-simulate-min.js&3.2.0/build/node/node-event-simulate-min.js"></script>
2931
<script type="text/javascript" src="scripts/lib/excanvas.compiled.js"></script>
3032
<script type="text/javascript" src="scripts/lib/includes.sylvester.src.js"></script>

scripts/tc.app.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var app = {
55
selector:'#app',
66
name:'Type/Code',
77
version:0.2,
8+
smallest_particle:2,
89
particle_panel:null
910
};
1011

@@ -14,12 +15,13 @@ var app = {
1415
app.Y.Node.one('title').setContent(app.name);
1516
app.Y.augment(app ,app.Y.EventTarget);
1617
if (app.Y.UA.webkit) {
17-
app.particle_panel = tc.particle.panel(app).render();
18-
if(app.particle_panel){
19-
app.particle_panel.add_squares(tc.squares.squares);
20-
}
18+
app.smallest_particle = 2;
2119
} else {
22-
app.Y.Node.one('body').addClass('fallback');
20+
app.smallest_particle = 4;
21+
}
22+
app.particle_panel = tc.particle.panel(app).render();
23+
if(app.particle_panel){
24+
app.particle_panel.add_squares(tc.squares.squares);
2325
}
2426
};
2527

@@ -31,4 +33,17 @@ var app = {
3133
}
3234
});
3335
fadeIn.run();
34-
};
36+
app.showBrowserHint();
37+
};
38+
39+
app.showBrowserHint = function() {
40+
if(app.smallest_particle != 2){
41+
var fadeIn = new app.Y.Anim({
42+
node: '.browser-hint',
43+
to: {
44+
opacity: 0.6
45+
}
46+
});
47+
fadeIn.run();
48+
}
49+
}

scripts/tc.app.particle.context.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ if(!tc){ var tc = {}; }
140140

141141
function _draw(){
142142
//tc.util.log('tc.particle.context[_me.draw]');
143-
var opacity, i;
143+
var opacity, i, alpha;
144144

145145
_me.context.globalAlpha = 1;
146146
_me.context.fillStyle = 'rgba(252,252,252,0.5)';
@@ -161,7 +161,13 @@ if(!tc){ var tc = {}; }
161161
);
162162
}
163163

164-
_me.context.globalAlpha = 1 - opacity + 0.01;
164+
if(opacity){
165+
alpha = 1 - opacity + 0.01;
166+
} else {
167+
alpha = 1;
168+
}
169+
170+
_me.context.globalAlpha = alpha;
165171

166172
for(i = 0; i < _me.particles.length; i++){
167173
_me.particles[i].draw(_me.context);

scripts/tc.app.particle.panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if(!tc){ var tc = {}; }
3232
this.add_squares = function(arr){
3333
var i;
3434
for(i = 0; i < arr.length; i++){
35-
if(arr[i].s < 2){ return; }
35+
if(arr[i].s < app.smallest_particle){ return; }
3636
(function(sq){
3737
var i, j, ax, ay;
3838
ax = ( sq.x );

0 commit comments

Comments
 (0)