Skip to content

Commit

Permalink
Nim/Kayles/DawsonsChess SVGs
Browse files Browse the repository at this point in the history
  • Loading branch information
cameroncheung00 committed Sep 24, 2023
1 parent bc2e591 commit 146e957
Show file tree
Hide file tree
Showing 19 changed files with 167 additions and 75 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
"preview:https": "serve dist",
"reinstall": "rm -rf node_modules; yarn; vue-tsc --noEmit"
},
"version": "5.0.0-alpha.264"
"version": "5.0.0-alpha.265"
}
5 changes: 1 addition & 4 deletions src/models/images/svg/dawsonschess/b.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/models/images/svg/dawsonschess/grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions src/models/images/svg/dawsonschess/o.svg

This file was deleted.

3 changes: 2 additions & 1 deletion src/models/images/svg/dawsonschess/x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/models/images/svg/general/basichitbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/models/images/svg/kayles/grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 13 additions & 9 deletions src/models/images/svg/konane/grid4x4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 14 additions & 10 deletions src/models/images/svg/konane/grid4x5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 15 additions & 10 deletions src/models/images/svg/konane/grid5x5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 16 additions & 12 deletions src/models/images/svg/konane/grid5x6.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 16 additions & 13 deletions src/models/images/svg/konane/grid6x6.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions src/models/images/svg/nim/grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/models/images/thumbnail/dawsonschess-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/models/images/thumbnail/kayles-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/models/images/thumbnail/konane-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/models/images/thumbnail/lights-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/models/images/thumbnail/nim-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 13 additions & 7 deletions src/scripts/gamesmanUni/moveAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,23 @@ const animateImageAutoGUI = (volume: number, currPosition: string, nextPosition:

var diffIdxs = [];
var i;
var entitiesAppear = false;

var svg = document.getElementById('image-autogui'); //Get svg element
var g = document.createElementNS("http://www.w3.org/2000/svg", 'g');
g.setAttribute("id", "animationForeground");
svg!.appendChild(g);

if (animationType === "entityFade") {
var entitiesAppear = false;
for (i = animationWindow[0]; i < animationWindow[1]; i++) {
if (currBoard[i] != nextBoard[i]) {
if (currBoard[i] != '-') { // Entity originally at center i shall fade out
if (currBoard[i] != '-' && currBoard[i] in entities) { // Entity originally at center i shall fade out
gsap.fromTo("#entity" + i, {autoAlpha: 1}, {duration: 0.5, autoAlpha: 0.001});
}
if (nextBoard[i] != '-') { // Entity that will be at center i shall fade in
entitiesAppear = true;
var appearingChar = nextBoard[i];
if (appearingChar in entities) {
entitiesAppear = true;
var newElement = document.createElementNS("http://www.w3.org/2000/svg", 'image');
newElement.setAttribute("class", "appearingEntity");
newElement.setAttribute("x", (centers[i][0] - 0.5 * entities[appearingChar].scale * widthFactor).toString());
Expand Down Expand Up @@ -192,11 +192,14 @@ const animateImageAutoGUI = (volume: number, currPosition: string, nextPosition:
}

for (i of fadeOutIdxs) {
gsap.fromTo("#entity" + i, {autoAlpha: 1}, {duration: 0.5, autoAlpha: 0.001});
if (currBoard[i] in entities) {
gsap.fromTo("#entity" + i, {autoAlpha: 1}, {duration: 0.5, autoAlpha: 0.001});
}
}
for (i of fadeInIdxs) {
var appearingChar = nextBoard[i];
if (appearingChar in entities) {
entitiesAppear = true;
var newElement = document.createElementNS("http://www.w3.org/2000/svg", 'image');
newElement.setAttribute("class", "appearingEntity");
newElement.setAttribute("x", (centers[i][0] - 0.5 * entities[appearingChar].scale * widthFactor).toString());
Expand All @@ -214,11 +217,11 @@ const animateImageAutoGUI = (volume: number, currPosition: string, nextPosition:
const idxTo = slide[1];
const toCoords = centers[idxTo];
const fromCoords = centers[idxFrom];
gsap.fromTo("#entity" + idxFrom, {autoAlpha: 1}, {duration: 0.001, autoAlpha: 0.001});

var movingChar = currBoard[idxFrom];
if (movingChar in entities) {
var newElement = document.createElementNS("http://www.w3.org/2000/svg", 'image');
gsap.fromTo("#entity" + idxFrom, {autoAlpha: 1}, {duration: 0.001, autoAlpha: 0.001});
var newElement = document.createElementNS("http://www.w3.org/2000/svg", 'image');
newElement.setAttribute("id", "movingEntity" + idxFrom);
newElement.setAttribute("x", (fromCoords[0] - 0.5 * entities[movingChar].scale * widthFactor).toString());
newElement.setAttribute("y", (fromCoords[1] - 0.5 * entities[movingChar].scale * widthFactor).toString());
Expand Down Expand Up @@ -297,7 +300,10 @@ export const animationEpilogue = (currentMatch: Types.Match) => {
if (imageAutoGUIData != null) {
// Note: gsap.set() is unreliable (only achieves the reset as intended
// 50% of the time for some reason) so we use fromTo instead
gsap.to(".entity", {duration: 0.001, opacity: 1});
var entities = document.getElementsByClassName('entity');
if (entities.length > 0) {
gsap.to(".entity", {duration: 0.001, opacity: 1});
}
if (document.getElementById("animationForeground")) {
document.getElementById("animationForeground")!.remove();
}
Expand Down

0 comments on commit 146e957

Please sign in to comment.