Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions dvd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ const dvdFieldDOM = document.getElementById("dvd-field");

class DVD {

constructor(dvdSvgDOM) {
constructor(dvdSvgDOM, x, y) {

this.dom = dvdSvgDOM
this.coord = { x: 0, y: 0 }
this.coord = { x: x, y: y }
this.speed = 0.26
this.rgbVec3 = [0, 0, 0]
this.previousTime = 0

this.dom.onclick = () => this.changeColor()
this.dom.ontouchstart = () => this.changeColor()
this.dom.onclick = () => {
this.changeColor();
runDVD(dvdFieldDOM.clientWidth - this.dom.clientWidth - x, y);
}
this.dom.ontouchstart = () => {
this.changeColor()
runDVD(dvdFieldDOM.clientWidth - this.dom.clientWidth - x, y);
}

this.changeColor()

Expand Down Expand Up @@ -47,9 +53,15 @@ class DVD {

}

function runDVD() {
function runDVD(x, y) {

const dvd = new DVD(document.getElementById("dvd"));
const template = document.querySelector("#dvd-template");
const body = document.querySelector("body");
const clone = document.importNode(template.content, true);
const svg = clone.querySelector(".dvd");
console.log(svg);
body.appendChild(svg);
const dvd = new DVD(svg, x, y);

function loop(dt) {
dvd.update(dt)
Expand All @@ -59,4 +71,4 @@ function runDVD() {

}

runDVD()
runDVD(0, 0)
16 changes: 9 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
z-index: -1;
}

svg#dvd {
svg.dvd {
height: 102px;
width: 208px;
top: 0px;
Expand Down Expand Up @@ -82,12 +82,14 @@ <h1>Serviver Agent</h1>
<div class="description">サバイバーエージェントはベンチャースピリットを持ったEitherT集団です</div>
<div id="particles-js"></div>
<div id="dvd-field"></div>
<svg xmlns="http://www.w3.org/2000/svg" id="dvd">
<path d="M118.895,20.346c0,0-13.743,16.922-13.04,18.001c0.975-1.079-4.934-18.186-4.934-18.186s-1.233-3.597-5.102-15.387H81.81H47.812H22.175l-2.56,11.068h19.299h4.579c12.415,0,19.995,5.132,17.878,14.225c-2.287,9.901-13.123,14.128-24.665,14.128H32.39l5.552-24.208H18.647l-8.192,35.368h27.398c20.612,0,40.166-11.067,43.692-25.288c0.617-2.614,0.53-9.185-1.054-13.053c0-0.093-0.091-0.271-0.178-0.537c-0.087-0.093-0.178-0.722,0.178-0.814c0.172-0.092,0.525,0.271,0.525,0.358c0,0,0.179,0.456,0.351,0.813l17.44,50.315l44.404-51.216l18.761-0.092h4.579c12.424,0,20.09,5.132,17.969,14.225c-2.29,9.901-13.205,14.128-24.75,14.128h-4.405L161,19.987h-19.287l-8.198,35.368h27.398c20.611,0,40.343-11.067,43.604-25.288c3.347-14.225-11.101-25.293-31.89-25.293h-18.143h-22.727C120.923,17.823,118.895,20.346,118.895,20.346L118.895,20.346z"/>
<path d="M99.424,67.329C47.281,67.329,5,73.449,5,81.012c0,7.558,42.281,13.678,94.424,13.678c52.239,0,94.524-6.12,94.524-13.678C193.949,73.449,151.664,67.329,99.424,67.329z M96.078,85.873c-11.98,0-21.58-2.072-21.58-4.595c0-2.523,9.599-4.59,21.58-4.59c11.888,0,21.498,2.066,21.498,4.59C117.576,83.801,107.966,85.873,96.078,85.873z"/>
<polygon points="182.843,94.635 182.843,93.653 177.098,93.653 176.859,94.635 179.251,94.635 178.286,102.226 179.49,102.226 180.445,94.635 182.843,94.635"/>
<polygon points="191.453,102.226 191.453,93.653 190.504,93.653 187.384,99.534 185.968,93.653 185.013,93.653 182.36,102.226 183.337,102.226 185.475,95.617 186.917,102.226 190.276,95.617 190.504,102.226 191.453,102.226"/>
</svg>
<template id="dvd-template">
<svg xmlns="http://www.w3.org/2000/svg" class="dvd">
<path d="M118.895,20.346c0,0-13.743,16.922-13.04,18.001c0.975-1.079-4.934-18.186-4.934-18.186s-1.233-3.597-5.102-15.387H81.81H47.812H22.175l-2.56,11.068h19.299h4.579c12.415,0,19.995,5.132,17.878,14.225c-2.287,9.901-13.123,14.128-24.665,14.128H32.39l5.552-24.208H18.647l-8.192,35.368h27.398c20.612,0,40.166-11.067,43.692-25.288c0.617-2.614,0.53-9.185-1.054-13.053c0-0.093-0.091-0.271-0.178-0.537c-0.087-0.093-0.178-0.722,0.178-0.814c0.172-0.092,0.525,0.271,0.525,0.358c0,0,0.179,0.456,0.351,0.813l17.44,50.315l44.404-51.216l18.761-0.092h4.579c12.424,0,20.09,5.132,17.969,14.225c-2.29,9.901-13.205,14.128-24.75,14.128h-4.405L161,19.987h-19.287l-8.198,35.368h27.398c20.611,0,40.343-11.067,43.604-25.288c3.347-14.225-11.101-25.293-31.89-25.293h-18.143h-22.727C120.923,17.823,118.895,20.346,118.895,20.346L118.895,20.346z"/>
<path d="M99.424,67.329C47.281,67.329,5,73.449,5,81.012c0,7.558,42.281,13.678,94.424,13.678c52.239,0,94.524-6.12,94.524-13.678C193.949,73.449,151.664,67.329,99.424,67.329z M96.078,85.873c-11.98,0-21.58-2.072-21.58-4.595c0-2.523,9.599-4.59,21.58-4.59c11.888,0,21.498,2.066,21.498,4.59C117.576,83.801,107.966,85.873,96.078,85.873z"/>
<polygon points="182.843,94.635 182.843,93.653 177.098,93.653 176.859,94.635 179.251,94.635 178.286,102.226 179.49,102.226 180.445,94.635 182.843,94.635"/>
<polygon points="191.453,102.226 191.453,93.653 190.504,93.653 187.384,99.534 185.968,93.653 185.013,93.653 182.36,102.226 183.337,102.226 185.475,95.617 186.917,102.226 190.276,95.617 190.504,102.226 191.453,102.226"/>
</svg>
</template>
<script src="dvd.js" defer></script>
<script src="particles.js" defer></script>
<script src="set.js" defer></script>
Expand Down