latin: unistrokes circles matched separately
[sheet.git] / word / memory.plp
index 1bb8cebb3ae6211b609e4bf14fa513ef4776410a..65184d83131dc09e00a178c17b22649e6b576672 100644 (file)
@@ -1,23 +1,27 @@
 <(../common.inc.plp)><:
 
+our $wordlistbase;
+
 Html({
        raw => <<'EOT',
 <script src="/word/put.min.js"></script>
+<script src="/word/quiz.js"></script>
 <script src="/word/memory.js"></script>
 <style>
 /* cards */
+#quiz {
+       display: grid;
+       grid: auto / repeat(6, 1fr);
+       grid-gap: 1ex;
+}
 html {
        overflow: hidden; /* rotation overflow on celebration */
 }
 
 figure {
-       display: inline-block;
        background: #224;
        border: 1px solid #888;
-       margin: 2px;
        perspective: 100em;
-       height: 300px;
-       position: relative;
 }
 figure:not(.turn):hover {
        cursor: pointer;
@@ -28,18 +32,25 @@ figure, img {
 
 /* card faces */
 figure img {
-       height: 100%;
-       width: auto;
        backface-visibility: hidden;
+       -webkit-backface-visibility: hidden;
        transform: rotateY(180deg); /* back */
        transform-style: preserve-3d;
        float: left; /* ff workaround to prevent click selection */
+       height: 100%;
+       object-fit: contain; /* center */
+}
+figure.mirror img {
+       transform: rotateY(180deg) scaleX(-1);
 }
 
 /* turn results */
 figure.turn img {
        transform: rotateY(0deg);
 }
+figure.mirror.turn img {
+       transform: rotateY(0deg) scaleX(-1);
+}
 figure.bad img {
        filter: sepia(.5) hue-rotate(-45deg) saturate(2); /* red tint */
 }
@@ -48,16 +59,19 @@ figure.good {
 }
 
 .good figure {
-       animation: celebration 5s linear infinite;
+       animation: celebration 7s linear infinite;
        background: none;
        border: 0;
+       opacity: 1;
 }
 @keyframes celebration {
        0% { filter: hue-rotate(0deg); transform: rotate(0deg) }
-       50% { filter: hue-rotate(180deg); transform: rotate(180deg) }
+       33% { filter: hue-rotate(180deg); transform: rotate(180deg) }
+       66% { filter: hue-rotate(360deg); transform: rotate(360deg) }
        100% { filter: hue-rotate(360deg); transform: rotate(360deg) }
 }
 </style>
 EOT
 });
 say '<h1>memory</h1><p id="quiz"></p>';
+say "<script>new WordMemory('/$wordlistbase.json')</script>";