Adventure Interactive Time in 2.75D

Developer
Size
2,716 Kb
Views
20,240

How do I make an adventure interactive time in 2.75d?

Move your mouse around to change camera's perspective. Exported from After Effects with bodymovin. . What is a adventure interactive time in 2.75d? How do you make a adventure interactive time in 2.75d? This script and codes were developed by Kittons on 09 September 2022, Friday.

Adventure Interactive Time in 2.75D Previews

Adventure Interactive Time in 2.75D - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Adventure Interactive Time in 2.75D</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="bodymovin"></div> <script src='https://labs.nearpod.com/bodymovin/demo/adventure_time/bodymovin.min.js'></script>
<script src='https://labs.nearpod.com/bodymovin/demo/adventure_time/data.js'></script> <script src="js/index.js"></script>
</body>
</html>

Adventure Interactive Time in 2.75D - Script Codes CSS Codes

body,
html { background-color: #ddd; margin: 0px; height: 100%; overflow: hidden;
}
#bodymovin { background-color: #000; width: 100%; height: 100%; display: block; transform: translate3d(0, 0, 0); margin: auto;
}

Adventure Interactive Time in 2.75D - Script Codes JS Codes

var anim; var elem = document.getElementById('bodymovin') var animationParams = { container: elem, renderer: 'html', loop: true, autoplay: true, rendererSettings: { progressiveLoad:false }, animationData: animData }; anim = bodymovin.loadAnimation(animationParams); var lockeds = { 2: false, 3: false, 4: false, 5: false } var currentLayerNum = -1; var currentPos = [500.5, 400, -2666.667]; var mousePos = [500.5, 400, -2666.667]; function moveCamera(){ currentPos[0] = currentPos[0] + (mousePos[0] - currentPos[0])*0.25; currentPos[1] = currentPos[1] + (mousePos[1] - currentPos[1])*0.25; currentPos[2] = currentPos[2] + (mousePos[2] - currentPos[2])*0.25; anim.animationData.layers[0].ks.p.k[0].s[0] = currentPos[0]; anim.animationData.layers[0].ks.p.k[0].e[0] = currentPos[0]; anim.animationData.layers[0].ks.p.k[0].s[1] = currentPos[1]; anim.animationData.layers[0].ks.p.k[0].e[1] = currentPos[1]; anim.animationData.layers[0].ks.p.k[0].s[2] = currentPos[2]; anim.animationData.layers[0].ks.p.k[0].e[2] = currentPos[2]; requestAnimationFrame(moveCamera); } anim.addEventListener('DOMLoaded', function(){ moveCamera(); window.addEventListener('mousemove', function(ev){ mouseCoords.x = ev.clientX || ev.pageX; mouseCoords.y = ev.clientY || ev.pageY; theta = Math.atan2( windowH/2 - mouseCoords.y, windowW/2 - mouseCoords.x ); var layerNum = 0; if(theta <= Math.PI && theta > Math.PI/2){ layerNum = 2; } else if(theta <= Math.PI/2 && theta > 0){ layerNum = 3; } else if(theta <= 0 && theta > -Math.PI/2){ layerNum = 4; } else{ layerNum = 5; } if(!lockeds[layerNum] && anim.currentFrame > 50){ lockeds[layerNum] = true; //if(currentLayerNum !== layerNum){ currentLayerNum = layerNum; anim.animationData.layers[layerNum].ip = Math.ceil(anim.currentRawFrame); anim.animationData.layers[layerNum].st = Math.ceil(anim.currentRawFrame); //} setTimeout(function(){ lockeds[layerNum] = false; },6000); } dist = Math.sqrt(Math.pow(mouseCoords.x - windowW/2, 2) + Math.pow(mouseCoords.y - windowH/2, 2)); mousePos[0] = 500.5 + Math.cos(theta)*dist; mousePos[1] = 400 + Math.sin(theta)*dist; }) window.addEventListener('mousewheel', function(ev){ //-2666.667 mousePos[2] += ev.wheelDelta; ev.preventDefault(); ev.stopImmediatePropagation(); }) }) var windowW, windowH, dist; var mouseCoords = { x:0, y:0 } function calculateSize(){ windowW = window.innerWidth; windowH = window.innerHeight; } window.addEventListener('resize', function(){ calculateSize(); anim.resize(); }) calculateSize();
Adventure Interactive Time in 2.75D - Script Codes
Adventure Interactive Time in 2.75D - Script Codes
Home Page Home
Developer Kittons
Username airnan
Uploaded September 09, 2022
Rating 4.5
Size 2,716 Kb
Views 20,240
Do you need developer help for Adventure Interactive Time in 2.75D?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Kittons (airnan) Script Codes
Create amazing art & images with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!