Bernard the polar bear

Developer
Size
4,070 Kb
Views
48,576

How do I make an bernard the polar bear?

What is a bernard the polar bear? How do you make a bernard the polar bear? This script and codes were developed by Massimo on 17 September 2022, Saturday.

Bernard the polar bear Previews

Bernard the polar bear - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Bernard the polar bear</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="bear"> <div class="ears-container"> <div class="ear"></div> <div class="ear"></div> </div> <div id="limit"> <div id="face"> <div class="eyes-container"> <div class="eye left-eye"></div> <div class="eye right-eye"></div> </div> <div class="phiz-container"> <div id="nose"> <div class="dot"></div> </div> <div class="mouth"></div> </div> </div> </div>
</div>
<div id="fish"> <div class="head"> <div class="fish-eye"></div> </div> <div class="fins"></div> <div class="tail"></div>
</div> <script src="js/index.js"></script>
</body>
</html>

Bernard the polar bear - Script Codes CSS Codes

html { width: 100%; height: 100%;
}
body { margin: 0; width: 100%; height: 100%; background: #5cd8fd; overflow: hidden; cursor: none;
}
body .bear { position: absolute; left: 50%; bottom: 0; width: 440px; height: 470px; margin-left: -220px; border-radius: 220px 220px 0 0; background: #fff;
}
body .bear .ears-container { position: absolute; width: 530px; height: 120px; left: 50%; top: 40px; margin-left: -265px;
}
body .bear .ears-container .ear { float: left; width: 120px; height: 120px; border-radius: 50%; background: #fff;
}
body .bear .ears-container .ear:last-child { float: right;
}
body .bear #limit { position: absolute; left: 50%; top: 10%; width: 240px; height: 270px; margin-left: -120px;
}
body .bear #limit #face { position: absolute; left: 50%; top: 6%; width: 140px; height: 230px; margin-left: -70px;
}
body .bear #limit #face .eyes-container { position: relative; left: 50%; width: 82px; height: 20px; margin-left: -41px;
}
body .bear #limit #face .eyes-container .eye { float: left; width: 20px; height: 100%; border-radius: 50%; background: #000;
}
body .bear #limit #face .eyes-container .eye:last-child { float: right;
}
body .bear #limit #face .phiz-container { margin-top: 10px; width: 100%; height: 200px; border-radius: 100px; background: #def9fe;
}
body .bear #limit #face .phiz-container #nose { position: relative; left: 50%; top: 6%; width: 88px; height: 88px; margin-left: -44px; border-radius: 50%; background: #000;
}
body .bear #limit #face .phiz-container #nose .dot { position: relative; left: 16%; top: 16%; width: 20px; height: 20px; border-radius: 50%; background: #fff;
}
body .bear #limit #face .phiz-container .mouth { position: absolute; left: 50%; bottom: 18%; width: 24px; height: 8px; margin-left: -12px; border-radius: 8px; background: #000;
}
body #fish { position: absolute; left: 50%; top: 50%; width: 20px; height: 74px; margin-left: -10px; margin-top: -37px;
}
body #fish .head { width: 100%; height: 60px; border-radius: 50%; background: #adadad;
}
body #fish .head .fish-eye { position: relative; left: 10px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: #fff;
}
body #fish .fins { position: absolute; left: -7px; top: 24px; width: 22px; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 16px solid #adadad;
}
body #fish .tail { position: relative; left: -6px; top: -2px; width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 16px solid #adadad;
}

Bernard the polar bear - Script Codes JS Codes

var limit = document.getElementById('limit'), face = document.getElementById('face'), nose = document.getElementById('nose'), fish = document.getElementById('fish'), ears = document.querySelectorAll('.ear');
var mouse = {x:0, y:0}, center = { x: window.innerWidth/2, y: window.innerHeight/2 }, limit = { left: - (limit.offsetWidth - face.offsetWidth) / 2, right: (limit.offsetWidth - face.offsetWidth) / 2, top: - (limit.offsetHeight - face.offsetHeight) / 2, bottom: (limit.offsetHeight - face.offsetHeight) / 2, }, eyeSize = 20, eyeSizeRate = 12, noseMoveRate = 2.5, earMoveRate = 3.5, faceMoveRate = 10;
function translate (selector, x, y) { selector.style.transform = 'translate(' + x + 'px,' + y + 'px)';
}
function interact (e) { mouse.x = e.touches ? e.touches[0].clientX : e.clientX; mouse.y = e.touches ? e.touches[0].clientY : e.clientY; var dx = (mouse.x - center.x)/faceMoveRate, dy = (mouse.y - center.y)/faceMoveRate, classX = dx < 0 ? 'left' : 'right'; dx = dx < limit.left ? limit.left : dx > limit.right ? limit.right : dx; dy = dy < limit.top ? limit.top : dy > limit.bottom ? limit.bottom : dy; var eye = document.getElementsByClassName(classX + '-eye')[0], size = Math.round(eyeSize - Math.abs(dx)/eyeSizeRate), margin = Math.round((eyeSize - size)/2); eye.style.cssText = 'width:' + size + 'px; \ height:' + size + 'px; \ margin-left:' + margin +'px; \ margin-top: ' + margin +'px;'; fish.style.cssText = 'left:' + mouse.x + 'px; \ top:' + mouse.y + 'px;' translate(face, dx, dy); for (var i = 0; i < ears.length; i++) { translate(ears[i], -dx/earMoveRate, -dy/earMoveRate); } translate(nose, dx/noseMoveRate, dy/noseMoveRate);
}
window.addEventListener("mousemove", interact);
window.addEventListener("touchmove", interact);
window.addEventListener("resize", function () { center.x = window.innerWidth/2; center.y = window.innerHeight/2;
});
Bernard the polar bear - Script Codes
Bernard the polar bear - Script Codes
Home Page Home
Developer Massimo
Username _massimo
Uploaded September 17, 2022
Rating 4.5
Size 4,070 Kb
Views 48,576
Do you need developer help for Bernard the polar bear?

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!

Massimo (_massimo) Script Codes
Name
ASCII art
Pacman
Cat loader
Run T-REX run in CSS
Css preloader
Shovel knight
Css wave
Record button
Css tabs
Fake 3D
Create amazing love letters 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!