Skip to content

Commit 4c9d3d1

Browse files
author
daniel-lundin
committed
Demo fix firefox
1 parent 9f972f9 commit 4c9d3d1

File tree

6 files changed

+50
-23
lines changed

6 files changed

+50
-23
lines changed

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Daniel Lundin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

dist/snabbt.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/cards.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
#toolbar {
3333
text-align: center;
3434
}
35+
p {
36+
text-align: center;
37+
}
3538
</style>
3639
</head>
3740
<body onload="init()">
@@ -46,6 +49,9 @@
4649
<button id="wall_button" class="button-primary">Wall</button>
4750
<button id="cylinder_button">Cylinder</button>
4851
</div>
52+
<div class="container">
53+
<p>DOM elements animated with <a href="index.html">snabbt.js</a>.</p>
54+
</div>
4955

5056
<script src="snabbt.min.js"></script>
5157
<script src="cards.js"></script>

docs/cards.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ var BOTTOM = 400;
1212

1313
var TILT = Math.PI/8;
1414
var PYTH_ANGLE = Math.PI/2 - TILT;
15-
var TILTED_CARD_HEIGHT = Math.sin(PYTH_ANGLE) * CARD_HEIGHT;
15+
var TILTED_CARD_HEIGHT = Math.sin(PYTH_ANGLE) * CARD_HEIGHT + 2;
1616
var TILTED_CARD_WIDTH = Math.cos(PYTH_ANGLE) * CARD_HEIGHT;
17-
var PYRAMID_WIDTH = TILTED_CARD_WIDTH * 2;
17+
var PYRAMID_WIDTH = TILTED_CARD_WIDTH * 2 + 4;
1818

1919
var COLORS = randomColor({
2020
count: 40,
@@ -40,16 +40,6 @@ function create_card(container, index) {
4040
card.style.width = CARD_WIDTH + 'px';
4141
card.style.background = COLORS[index % COLORS.length];
4242

43-
//var front = document.createElement('div');
44-
//front.className = 'front';
45-
//front.style.background = COLORS[index % COLORS.length];
46-
47-
//var back = document.createElement('div');
48-
//back.className = 'back';
49-
//back.style.background = COLORS[index % COLORS.length];
50-
51-
//card.appendChild(front);
52-
//card.appendChild(back);
5343
container.appendChild(card);
5444
return card;
5545
}
@@ -89,7 +79,6 @@ function build_formation(positions) {
8979
position: positions[i].position,
9080
rotation: positions[i].rotation,
9181
easing: 'cos',
92-
//perspective: 2000,
9382
delay: i * 50
9483
});
9584
}
@@ -110,7 +99,7 @@ function set_mode(mode) {
11099

111100
build_formation(positions);
112101
current_mode = mode;
113-
}
102+
};
114103

115104
function rotate_container() {
116105
var container = document.getElementById('surface');
@@ -175,7 +164,8 @@ function house_row_positions(count, x, y, z) {
175164
}
176165

177166
function pyramid_postions(x, y, z) {
178-
var spacing = TILTED_CARD_WIDTH / 2;
167+
// Firefox flickers if elements overlap
168+
var spacing = (TILTED_CARD_WIDTH / 2) + 2;
179169

180170
return [{
181171
position: [x - spacing, y, z],

0 commit comments

Comments
 (0)