Skip to content

Commit 1f63c79

Browse files
committed
Enhancement of appearance
Improved game appearance
1 parent 63fd9b2 commit 1f63c79

File tree

2 files changed

+65
-21
lines changed

2 files changed

+65
-21
lines changed

css/style.css

+39
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,43 @@ svg {
1818

1919
.point{
2020
font-size:4em;
21+
}
22+
.piece{
23+
animation: pulse 5s infinite;
24+
fill-color:#ffffff;
25+
}
26+
27+
@keyframes pulse {
28+
0% {
29+
fill: currentColor;
30+
}
31+
100% {
32+
fill: #FF4136;
33+
}
34+
}
35+
36+
.piecesB{
37+
animation: pulse 5s 1;
38+
}
39+
40+
@keyframes pulseB{
41+
0%{
42+
fill: #fff;
43+
}
44+
100%{
45+
fill: #000;
46+
}
47+
}
48+
49+
.piecesW{
50+
animation: pulseW 5s 1;
51+
}
52+
53+
@keyframes pulseW {
54+
0% {
55+
fill: #000;
56+
}
57+
100% {
58+
fill: #FFf;
59+
}
2160
}

js/script.js

+26-21
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ function start() {
4343
otPlayer= playerB;
4444

4545
var a = ((cW-cH)/2),
46-
aux = (document.documentElement.clientHeight)-cH;
47-
bk = (cH-cH*.05)/8;
46+
aux = (document.documentElement.clientHeight)-cH,
47+
bk = (cH-cH*.05)/8,
48+
f = gm.filter(Snap.filter.shadow(2, 4, .5)),
4849

4950
table= gm.rect(a , bk*.25, cH-bk*.45, cH-bk*.45).attr({
5051
fill: "#060",
5152
id: "table",
5253
stroke:"#000",
5354
strokeWidth:"3"
54-
});
55+
}),
5556
score= gm.rect(0,cH-bk*.15, cW, aux).attr({
5657
fill: "#bbc495",
5758
id: "scoreB"
@@ -60,24 +61,28 @@ function start() {
6061
scrW= gm.rect(bk*.1,cH-bk*.15,(cW-.2*bk)/2, aux-bk*.1).attr({
6162
fill: "#e8edde",
6263
id: "scoreW"
63-
})
64+
}),
6465

6566
plW= gm.text((cW-.2*bk)/4.5, cH*(1.05), "White").attr({
66-
"class": "score"
67-
});
67+
"class": "score",
68+
filter: f
69+
}),
6870

6971
plWS= gm.text((cW-.2*bk)/4.3, cH*(1.16),2).attr({
7072
"class": "score point",
71-
id:"pntsW"
72-
});
73+
id:"pntsW",
74+
filter: f
75+
}),
7376

7477
plB= gm.text((cW-.2*bk)/1.35, cH*(1.05), "Black").attr({
75-
"class": "score"
76-
});
78+
"class": "score",
79+
filter: f
80+
}),
7781

7882
plBS= gm.text((cW-.2*bk)/1.34, cH*(1.16),2).attr({
7983
"class": "score point",
80-
id:"pntsB"
84+
id:"pntsB",
85+
filter: f
8186
});
8287

8388
g = gm.g();
@@ -103,13 +108,16 @@ function start() {
103108
r = bk/3;
104109
for( y = 0 ; y<8; y++){
105110
for (var x = 0; x<8; x++){
106-
var circle = gm.circle((x*bk+x1), (y*bk+y1), r).attr({
107-
strokeWidth: 1,
108-
stroke: "#000",
109-
fill: "#060",
110-
id: (x+""+y)
111-
});
112-
var text = gm.text((x*bk+x1), (y*bk+y1), x+""+y );
111+
var f = gm.filter(Snap.filter.shadow(0, 2, .7)),
112+
circle = gm.circle((x*bk+x1), (y*bk+y1), r).attr({
113+
strokeWidth: 2,
114+
stroke: "#010",
115+
"stroke-opacity": .4,
116+
fill: "#060",
117+
id: (x+""+y),
118+
filter: f
119+
});
120+
//var text = gm.text((x*bk+x1), (y*bk+y1), x+""+y );
113121
circle.node.onclick = function (e){
114122
put(e);
115123
};
@@ -141,9 +149,6 @@ function put(circle){
141149
otPlayer = tmp;
142150
}
143151
}
144-
145-
146-
147152
actualPlayer.inGame();
148153
document.getElementById("pntsB").innerHTML;
149154
document.getElementById("pntsW").innerHTML;

0 commit comments

Comments
 (0)