Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subtask2-1/added-information #619

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion subtask2-1/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ using namespace std;

int main()
{
cout<<"Hello World"<<endl;
cout<<"Hello Ashmit Verma| 220108012"<<endl;
return 0;
}
Binary file added subtask2-2/Music/music.mpeg
Binary file not shown.
74 changes: 42 additions & 32 deletions subtask2-2/script.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,73 @@

var radius = 240;
var autoRotate = true;
var radius = 240;
var autoRotate = true;
var rotateSpeed = -60;
var imgWidth = 120;
var imgHeight = 170;
var imgWidth = 120;
var imgHeight = 170;

// the task starts here
// the task starts here
// currently the bgMusicURL is not working
// create a folder called Music and insert a music file in it then the music on the website should work
bgMusicURL = './Music/music.mp3'
var bgMusicControls = true;
bgMusicURL = "./Music/music.mpeg";
var bgMusicControls = true;

setTimeout(init, 1000);

var odrag = document.getElementById('drag-container');
var ospin = document.getElementById('spin-container');
var aImg = ospin.getElementsByTagName('img');
var aVid = ospin.getElementsByTagName('video');
var aEle = [...aImg, ...aVid];

var odrag = document.getElementById("drag-container");
var ospin = document.getElementById("spin-container");
var aImg = ospin.getElementsByTagName("img");
var aVid = ospin.getElementsByTagName("video");
var aEle = [...aImg, ...aVid];

ospin.style.width = imgWidth + "px";
ospin.style.height = imgHeight + "px";


var ground = document.getElementById('ground');
var ground = document.getElementById("ground");
ground.style.width = radius * 3 + "px";
ground.style.height = radius * 3 + "px";

function init(delayTime) {
for (var i = 0; i < aEle.length; i++) {
aEle[i].style.transform = "rotateY(" + (i * (360 / aEle.length)) + "deg) translateZ(" + radius + "px)";
aEle[i].style.transform =
"rotateY(" +
i * (360 / aEle.length) +
"deg) translateZ(" +
radius +
"px)";
aEle[i].style.transition = "transform 1s";
aEle[i].style.transitionDelay = delayTime || (aEle.length - i) / 4 + "s";
}
}

function applyTranform(obj) {
if(tY > 180) tY = 180;
if(tY < 0) tY = 0;
obj.style.transform = "rotateX(" + (-tY) + "deg) rotateY(" + (tX) + "deg)";
if (tY > 180) tY = 180;
if (tY < 0) tY = 0;
obj.style.transform = "rotateX(" + -tY + "deg) rotateY(" + tX + "deg)";
}

function playSpin(yes) {
ospin.style.animationPlayState = (yes?'running':'paused');
ospin.style.animationPlayState = yes ? "running" : "paused";
}

var sX, sY, nX, nY, desX = 0,
desY = 0,
tX = 0,
tY = 10;
var sX,
sY,
nX,
nY,
desX = 0,
desY = 0,
tX = 0,
tY = 10;
if (autoRotate) {
var animationName = (rotateSpeed > 0 ? 'spin' : 'spinRevert');
ospin.style.animation = `${animationName} ${Math.abs(rotateSpeed)}s infinite linear`;
var animationName = rotateSpeed > 0 ? "spin" : "spinRevert";
ospin.style.animation = `${animationName} ${Math.abs(
rotateSpeed
)}s infinite linear`;
}

if (bgMusicURL) {
document.getElementById('music-container').innerHTML += `
<audio src="${bgMusicURL}" ${bgMusicControls? 'controls': ''} autoplay loop>
document.getElementById("music-container").innerHTML += `
<audio src="${bgMusicURL}" ${
bgMusicControls ? "controls" : ""
} autoplay loop>
<p>If you are reading this, it is because your browser does not support the audio element.</p>
</audio>
`;
Expand All @@ -67,12 +77,12 @@ document.onpointerdown = function (e) {
clearInterval(odrag.timer);
e = e || window.event;
var sX = e.clientX,
sY = e.clientY;
sY = e.clientY;

this.onpointermove = function (e) {
e = e || window.event;
var nX = e.clientX,
nY = e.clientY;
nY = e.clientY;
desX = nX - sX;
desY = nY - sY;
tX += desX * 0.1;
Expand Down Expand Up @@ -101,7 +111,7 @@ document.onpointerdown = function (e) {
return false;
};

document.onmousewheel = function(e) {
document.onmousewheel = function (e) {
e = e || window.event;
var d = e.wheelDelta / 20 || -e.detail;
radius += d;
Expand Down