Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating fork from original #1

Merged
merged 27 commits into from
Mar 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8f02259
Added resources for creating dynamic cards, updated css rules.
Feb 25, 2017
6a652d1
Switched to using dynamic cards
Feb 26, 2017
64548db
Create README.md
Feb 26, 2017
5c6c659
Added Stone Golems and Scouts as enemies, as well as some TODO
Feb 27, 2017
5384389
Fix the horizontal flip issue
Feb 27, 2017
e287051
Add Cave Bears, Giant Viper and Hound; with its related macros.
Feb 27, 2017
d004ce4
Added Imp, Ooze and Rending drake, and fixed some spelling errors. Co…
Feb 27, 2017
4229246
Merge pull request #2 from GinoGalotti/adding-new-monster-cards
Feb 27, 2017
cf7ea5e
Added macro for "Use Element" icon, moved mirror css to cards.css
Feb 27, 2017
831d49b
Added icons for AoE abilities
Feb 27, 2017
2ebd259
Switched to correct font for card text
Feb 27, 2017
0f2f33d
cards.js updates
Feb 27, 2017
94d6fd5
updated use macros to %use_element% format
Feb 27, 2017
841278b
Remainder of enemies added.
Feb 27, 2017
614f217
Completed Scenario list
Feb 27, 2017
63a0ec5
Added remaining macros used by monsters
Feb 27, 2017
7d7c085
Cropped whitespace from icons
Feb 27, 2017
128fd29
Merge branch 'sfrazer'
Feb 27, 2017
cce14c6
Fixed render order for %use_element%
Feb 27, 2017
79ae8de
Mitigated some layout issues
Feb 28, 2017
f59c480
Fix hidden end of tab body on Android Chrome
dlpierce Mar 1, 2017
f744791
Enhanced flip animation for card draws
Mar 1, 2017
17441f2
Merge pull request #7 from moofed/master
Mar 1, 2017
86e06bb
Preliminary card scaling, more compact tabluae, simplified card posit…
Mar 1, 2017
174290c
Fixed z-order for animations
Mar 2, 2017
09fa4c2
Added text scaling according to card size
Mar 2, 2017
7340d13
Toned down animations, allowed for more aggresive downscaling on smal…
Mar 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enhanced flip animation for card draws
  • Loading branch information
JR committed Mar 1, 2017
commit f74479128d241b1ee0cb0c385347668db4a8d6e6
50 changes: 30 additions & 20 deletions cards.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,37 @@
src: url(PirataOne-Gloomhaven.ttf);
}

@keyframes pull
{
50% { top: -100%; bottom: 100%; }
}

.card-container
{
position: relative;
text-align: center;

width: calc(437px + 2rem);
width: calc(437px + 1rem);
max-width: 100%;
max-height: 100vh;
margin: 1rem;
}

.card-container::before
{
content: "";
visibility: hidden;
display: inline-block;
padding-bottom: calc(67.7% + 1rem);
padding-bottom: calc(67.7%);
}

.card
{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
bottom: 1rem;
right: 1rem;

width: 437px;
height: 296px;
max-width: calc(147.6vh);
max-height: calc(100vh);

Expand All @@ -56,16 +59,30 @@

.card.draw
{
left: 0.5rem;
top: 0.5rem;
}
top: 0;
left: 0;
bottom: 1rem;
right: 1rem;

.card.
transition-property: top, left, bottom, right, transform;
transition-timing-function: ease;
transition-duration: 0.4s, 0.4s, 0.4s;
}

.card.discard
{
left: 1.5rem;
top: 1.5rem;
top: 1rem;
left: 1rem;
bottom: 0;
right: 0;

transition-property: top, bottom, left, right, transform, z-index;
transition-timing-function: ease;
transition-duration: 0.4s, 0.4s, 0.5s, 0.5s, 0.4s, 0s;
transition-delay: 0.5s, 0.5s, 0s, 0s, 0.25s, 0.25s;

animation-name: pull;
animation-duration: 0.5s;
}

.card.front
Expand Down Expand Up @@ -199,13 +216,6 @@ img[src="images/shuffle.svg"]
background: rgba(0, 0, 0, 0);
}

.flip
{
transition-property: left, top, transform;
transition-duration: 0.4s;
transition-timing-function: ease;
}

.up
{
transform: rotateY(0deg);
Expand Down
23 changes: 13 additions & 10 deletions logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ function UICard(front_element, back_element)

card.flip_up = function(faceup)
{
this.pop_up();

toggle_class(this.back, "flip", true);
toggle_class(this.back, "up", !faceup);
toggle_class(this.back, "down", faceup);

toggle_class(this.front, "flip", true);
toggle_class(this.front, "up", faceup);
toggle_class(this.front, "down", !faceup);
};
Expand All @@ -35,11 +31,11 @@ function UICard(front_element, back_element)
this.front.style.zIndex -= 1;
};

card.pop_up = function()
card.set_depth = function(z)
{
this.back.style.zIndex = 0;
this.front.style.zIndex = 0;
};
this.back.style.zIndex = z;
this.front.style.zIndex = z;
}

card.attach = function(parent)
{
Expand Down Expand Up @@ -205,7 +201,7 @@ function reshuffle(deck)
var card = deck.draw_pile[i];
card.ui.flip_up(false);
card.ui.set_discarded(false);
card.ui.push_down();
card.ui.set_depth(0);
}
}

Expand All @@ -229,14 +225,21 @@ function draw_card(deck)
}
else
{
var card = deck.draw_pile.shift(card);

for (var i = 0; i < deck.discard.length; i++)
{
deck.discard[i].ui.push_down();
}
for (var i = 0; i < deck.draw_pile.length; i++)
{
deck.draw_pile[i].ui.push_down();
}

var card = deck.draw_pile.shift(card);
card.ui.flip_up(true);
card.ui.set_discarded(true);
card.ui.set_depth(0);

deck.discard.unshift(card);
}
}
Expand Down