Commit aa99249e0bcc62b80333f9ffb08386926752d076

Authored by Rachel Lee
1 parent 5498e58201

Fix ugly flashcard pull/unpull visuals; added animation

Showing 3 changed files with 24 additions and 26 deletions Side-by-side Diff

scripts/FlashcardFactory.js View file @ aa99249
... ... @@ -28,6 +28,10 @@
28 28 Flashcard.prototype.isInDeck = function () {
29 29 return !(typeof Deck[this.id] === 'undefined');
30 30 };
  31 + Flashcard.prototype.pullUnpull = function() {
  32 + if (Deck[this.id]) this.unpull();
  33 + else this.pull();
  34 + };
31 35 Flashcard.prototype.pull = function () {
32 36 if (Deck[this.id]) return console.log('Not pulling', this.id, "because it's already in deck");
33 37 return $http.post('/api/flashcards/' + this.id + '/pull/');
styles/flashy.css View file @ aa99249
... ... @@ -58,15 +58,8 @@
58 58 float: left;
59 59 text-align: center;
60 60 margin: 6px;
61   - /*transition: all 0.2s cubic-bezier(0, 0, 0.6, 1);*/
62 61 }
63 62  
64   -/*.card.flashy.shrinky {*/
65   -/*height: 0;*/
66   -/*opacity: 0;*/
67   -/*overflow: hidden;*/
68   -/*}*/
69   -
70 63 .card-overlay {
71 64 cursor: pointer;
72 65 left: 0;
... ... @@ -74,7 +67,7 @@
74 67 position: absolute;
75 68 /*pointer-events: none;*/
76 69 top: 0;
77   - transition: visibility 0s cubic-bezier(0, 0, 0.6, 1) 0.2s,
  70 + transition: visibility 0s cubic-bezier(0, 0, 0.6, 1) 0.0s,
78 71 opacity 0.2s cubic-bezier(0, 0, 0.6, 1);
79 72 /* animation effect to appear on off-hover */
80 73 visibility: hidden;
81 74  
82 75  
83 76  
... ... @@ -407,20 +400,22 @@
407 400 will-change: opacity;
408 401 }
409 402  
410   -.dropping.ng-enter {
411   - max-height: 0vh;
  403 +.fadey.ng-enter {
  404 + opacity: 0.5;
  405 + transform: translate(-50%, -50%) rotate(90deg);
412 406 }
413 407  
414   -.dropping.ng-enter-active {
415   - max-height: 100vh;
  408 +.fadey.ng-enter-active {
  409 + opacity: 1;
  410 + transform: translate(-50%, -50%) rotate(0deg);
416 411 }
417 412  
418   -.dropping.ng-leave {
419   - max-height: 100vh;
  413 +.fadey.ng-leave {
  414 + opacity: 1;
420 415 }
421 416  
422   -.dropping.ng-leave-active {
423   - max-height: 0vh;
  417 +.fadey.ng-leave-active {
  418 + opacity: 0;
424 419 }
425 420  
426 421 /* REPLACEMENT FOR MATERIALIZE ACCORDION/COLLAPSIBLE
templates/flashcard.html View file @ aa99249
1   -<div class="card flashy smallify black-text text-darken-2"
  1 +<div class="card flashy black-text"
2 2 ng-class="{'in-deck':flashcard.isInDeck()}">
3 3 <div class="valign-wrapper">
4 4 <div class="card-content valign center-align" ng-bind-html="flashcard.formatted_text"></div>
5 5 </div>
6 6 <div class="card-overlay">
7   - <div class="top-box no-user-select" ng-show="!flashcard.isInDeck()"
8   - ng-click="flashcard.pull()">
9   - <div class="center-me"><i class="mdi-content-add-circle-outline medium"></i></div>
10   - </div>
11   - <div class="top-box no-user-select" ng-show="flashcard.isInDeck()"
12   - ng-click="flashcard.unpull()">
13   - <div class="center-me"><i class="mdi-content-remove-circle-outline medium"></i></div>
  7 + <div class="top-box no-user-select"
  8 + ng-click="flashcard.pullUnpull()">
  9 + <div class="center-me">
  10 + <i ng-if="flashcard.isInDeck()" class="fadey mdi-content-remove-circle-outline medium"></i>
  11 + <i ng-if="!flashcard.isInDeck()" class="fadey mdi-content-add-circle-outline medium"></i>
  12 + </div>
14 13 </div>
15 14 <div class="bottom-box no-user-select">
16 15 <div class="left-box tooltipped" data-position="bottom" data-tooltip="Info">