summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/static/style.css10
-rw-r--r--web/static/sw.js2
-rw-r--r--web/web_control.c6
-rw-r--r--web/web_svg.c7
-rw-r--r--web/web_svg.h2
5 files changed, 25 insertions, 2 deletions
diff --git a/web/static/style.css b/web/static/style.css
index 47ae365..57c670a 100644
--- a/web/static/style.css
+++ b/web/static/style.css
@@ -372,6 +372,16 @@ body {
filter: drop-shadow(0 0 0.4rem #111);
}
+@keyframes throw-anim {
+ 0% { transform: scale(8); }
+ 100% { transform: scale(1); }
+}
+
+#controls #keypad-dartboard #dartboard g.overlay circle:last-child {
+ transform-box: fill-box;
+ transform-origin: center;
+}
+
#controls .key {
color: #ccc;
background-color: #282828;
diff --git a/web/static/sw.js b/web/static/sw.js
index ba14e30..13e75af 100644
--- a/web/static/sw.js
+++ b/web/static/sw.js
@@ -1,5 +1,5 @@
const CACHE_PREFIX = 'dartboat-'
-const CACHE_VERSION = '10';
+const CACHE_VERSION = '11';
const CACHE_NAME = `${CACHE_PREFIX}${CACHE_VERSION}`;
const CACHE_FILES = [
diff --git a/web/web_control.c b/web/web_control.c
index b0dfd3b..0d8cd46 100644
--- a/web/web_control.c
+++ b/web/web_control.c
@@ -111,10 +111,14 @@ void boat_visit()
struct ccoords c = v->ccoords[i];
+ int delay = delay_ms * (i + 1);
+ if (delay_ms >= SVG_THROW_ANIM_MS)
+ delay -= SVG_THROW_ANIM_MS;
+
char *tmp = malloc(len_str + 1); // free in draw_boat_throwing
memcpy(tmp, str, len_str + 1);
EM_ASM({scheduleCCall($0, $1, $2, $3, $4, $5, $6)},
- "draw_boat_throwing", delay_ms * (i+1),
+ "draw_boat_throwing", delay,
pts, tmp, c.x, c.y, curr_match_id);
}
diff --git a/web/web_svg.c b/web/web_svg.c
index 470b7ec..485583d 100644
--- a/web/web_svg.c
+++ b/web/web_svg.c
@@ -1,5 +1,6 @@
#include "web_svg.h"
#include "web_dom.h"
+#include "web_opts.h"
#include "board.h"
#include "comp.h"
@@ -224,6 +225,12 @@ void svg_draw_point(double x, double y)
dom_elem_add_attrd(e, "cx", x);
dom_elem_add_attrd(e, "cy", y);
+ if (delay_ms >= SVG_THROW_ANIM_MS) {
+ char buf[64];
+ sprintf(buf, "animation: throw-anim %dms;", SVG_THROW_ANIM_MS);
+ dom_elem_add_attr(e, "style", buf);
+ }
+
dom_append_elemv("#dartboard .overlay", 1, &e);
dom_elem_free(e);
}
diff --git a/web/web_svg.h b/web/web_svg.h
index d2b3e0d..9110200 100644
--- a/web/web_svg.h
+++ b/web/web_svg.h
@@ -1,6 +1,8 @@
#ifndef WEB_SVG_H
#define WEB_SVG_H
+#define SVG_THROW_ANIM_MS 250
+
void svg_init();
void svg_draw_point(double x, double y);
void svg_clear_points();