From 39446f0459a1035755a93657e4b397cf37eae65d Mon Sep 17 00:00:00 2001 From: karthik558 Date: Tue, 22 Jun 2021 22:40:42 +0530 Subject: [PATCH] website: Re-design [Download-Page] * Old one looks lit bit weird, sooo switch to new simple design. * Thanks to vanilla-tilt.js (for awesome animation) Signed-off-by: K A R T H I K --- css/style.css | 289 ++++++++++---------------- download.html | 122 ++++++----- js/vanilla-tilt.js | 508 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 683 insertions(+), 236 deletions(-) create mode 100644 js/vanilla-tilt.js diff --git a/css/style.css b/css/style.css index 0a7cabc..fb02460 100644 --- a/css/style.css +++ b/css/style.css @@ -248,148 +248,126 @@ html { } /* ========================================================================================================== - DOWNLOAD + DOWNLOAD PAGE ========================================================================================================== */ - - #download { - background: linear-gradient(#8946E8,#5619ac); - background-size: cover; - text-align: center; - color: fff; - padding: 5%; - margin: 1px; - border-top: 1px solid #000; - border-bottom: 1px solid #000; - } - - .about_para { - margin-top: 4px; - margin-bottom: 4px; - padding-bottom: 10px; - font-size: 17px; - text-align: left; + + #fh5co-hero-wrapperr { + width: 100%; + border-radius: 0 0 50% 50% / 4%; } - - #phones { - display: inline-block; - text-align: center; - align-content: center; + +.containerr +{ + position: relative; + display: flex; + justify-content: center; align-items: center; - color:rgb(255, 255, 255) - - } - - #phone.jasmine { - background-color: #160831; - opacity: 90%; - float: left; - display: block; - width: 300px; - border: 0px solid rgb(0, 0, 0); - border-radius: 15%; - margin: 30px; - padding-bottom: 5%; - transform: scale(1.0); - transition: 0.5s; - text-align: center; - align-content: center; + padding: 40px 0; + flex-wrap: wrap; +} +.containerr .box +{ + position: relative; + width: 320px; + height: 400px; + color: #fff; + background: #111; + display: flex; + justify-content: center; align-items: center; - } - #phone.jasmine:hover{ - transform: scale(1.1); - transition: 0.5s; - box-shadow: 1px 1px 20px #000000; - color:rgb(255, 255, 255); - opacity: 100%; - } - - #phone.wayne { - background-color: #160831; - opacity: 90%; - float: left; - display: block; - width: 300px; - border: 0px solid rgb(0, 0, 0); - border-radius: 15%; - margin: 30px; - padding-bottom: 5%; - transform: scale(1.0); - transition: 0.5s; - } - - #phone.wayne:hover{ - transform: scale(1.1); - transition: 0.5s; - box-shadow: 1px 1px 20px #000000; - color:rgb(255, 255, 255); - opacity: 100%; - } - - #phone.violet { - background-color: #160831; - opacity: 90%; - float: left; - display: block; - width: 300px; - border: 0px solid rgb(0, 0, 0); - border-radius: 15%; - margin: 30px; - padding-bottom: 5%; - transform: scale(1.0); - transition: 0.5s; - } - - #phone.violet:hover{ - transform: scale(1.1); - transition: 0.5s; - box-shadow: 1px 1px 20px #000000; - color:rgb(255, 255, 255); - opacity: 100%; - } - - #phone.lavender { - background-color: #160831; - opacity: 90%; - float: left; - display: block; - width: 300px; - border: 0px solid rgb(0, 0, 0); - border-radius: 15%; - margin: 30px; - padding-bottom: 5%; - transform: scale(1.0); - transition: 0.5s; - } - - #phone.lavender:hover{ - transform: scale(1.1); - transition: 0.5s; - box-shadow: 1px 1px 20px #000000; - color:rgb(255, 255, 255); - opacity: 100%; - } - - #phone.ginkgo { - background-color: #160831; - opacity: 90%; - float: left; - display: block; - width: 300px; - border: 0px solid rgb(0, 0, 0); - border-radius: 15%; - margin: 30px; - padding-bottom: 5%; - transform: scale(1.0); - transition: 0.5s; - } - - #phone.ginkgo:hover{ - transform: scale(1.1); + margin: 20px 30px; transition: 0.5s; - box-shadow: 1px 1px 20px #000000; - color:rgb(255, 255, 255); - opacity: 100%; - } +} +.containerr .box:hover +{ + transform: translate(-20px); +} + +.containerr .box::before +{ + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: linear-gradient(315deg, #5a01ff, #901aff); +} +.containerr .box::after +{ + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: linear-gradient(105deg, #1b003a, #3a0046); + filter: blur(20px); +} +.containerr .box:nth-child(2)::before +.containerr .box:nth-child(2)::after +{ + background: linear-gradient(315deg, #03a9f4, #ff0058); +} +.containerr .box:nth-child(3)::before +.containerr.box:nth-child(3)::after +{ + background: linear-gradient(315deg, #4dff03, #00d0ff); +} +.containerr .box span +{ + position: absolute; + top: 6px; + left: 6px; + right: 6px; + bottom: 6px; + background: rgb(9 10 15); + z-index: 2; +} +.containerr .box span::before +{ + content: ''; + position: absolute; + top: 0; + left: 0; + width: 50%; + height: 100%; + background: rgba(255,255,255,0.1); + pointer-events: none; +} +.containerr .box .content +{ + position: relative; + z-index: 10; + padding: 20px 40px; +} +.containerr .box .content h2 +{ + font-size: 2em; + color: #fff; + margin-bottom: 10px; +} +.containerr .box .content p +{ + font-size: 1.1em; + color: #fff; + margin-bottom: 10px; + line-height: 1.4em; +} +.containerr .box .content a{ + display: inline-block; + font-size: 1.1em; + color: black; + background: #fff; + border-radius: 20px; + padding: 10px; + text-decoration: none; + font-weight: 700; +} +.containerr .box .content:hover a{ +color: #fff; +background: black; +} /* ========================================================================================================== FEATURES @@ -560,39 +538,6 @@ html { font-weight: 600; } -/* ========================================================================================================== - REVIEWS - ========================================================================================================== */ -.fh5co-reviews-outer { - width: 100%; - height: 400px; - padding: 70px; - margin-top: 100px; -} -.fh5co-reviews-outer .fh5co-reviews-inner { - margin-top: 100px; -} -.fh5co-reviews-outer > h1 { - color: #648cff; - text-transform: uppercase; - font-size: 30px; - font-weight: 600; - margin-bottom: 10px; - text-align: center; -} -.fh5co-reviews-outer > small { - text-align: center; - display: block; -} -.fh5co-reviews-outer .testimonial-desc { - clear: both; - padding-top: 30px; - font-weight: 500; -} -.fh5co-reviews-outer .testimonial-2 { - margin-left: 50px; -} - /* ========================================================================================================== BOTTOM ========================================================================================================== */ @@ -895,10 +840,6 @@ html { overflow-x: hidden; } - #fh5co-hero-wrapper { - - height: 95vh; - - } - .fh5co-hero-inner { margin-top: 30px; } diff --git a/download.html b/download.html index bf4a0e7..f2d6522 100644 --- a/download.html +++ b/download.html @@ -44,7 +44,7 @@ HERO ========================================================================================================== --> -
+
+
- -
-
- -
- -
-
- smartphone-1 -
-
- -
-

Xiaomi Mi A2 (jasmine))

- Download -
- -
-

Redmi Note 7 Pro (violet)

- Download -
- -
- smartphone-2 -
- -
-
- smartphone-3 -
-
-
-

Xiaomi Mi 6X (wayne)

- Download -
-
-

Redmi Note 8 (ginkgo)

- Download -
- -
- smartphone-2 -
-
-
- smartphone-3 -
-
-
-

Redmi Note 7 (lavender)

- Download -
-
-
-
+ DOWNLOAD + ========================================================================================================== --> +
+
+ +
+

Redmi Note 7 Pro

+

[violet]

+
+ Download +
-
+
+
+ +
+

Redmi Note 7

+

[lavender]

+
+ Download +
+
+ +
+

Redmi Note 8

+

[ginkgo]

+
+ Download +
+
+ +
+

Xiaomi MI A2

+

[jasmine]

+
+ Download +
- +
+ +
+

Xiaomi MI 6X

+

[wayne]

+
+ Download +
+
+
@@ -162,7 +151,7 @@

RohieOS

- + @@ -174,5 +163,14 @@

RohieOS

+ + \ No newline at end of file diff --git a/js/vanilla-tilt.js b/js/vanilla-tilt.js new file mode 100644 index 0000000..7a1ed83 --- /dev/null +++ b/js/vanilla-tilt.js @@ -0,0 +1,508 @@ +var VanillaTilt = (function () { +'use strict'; + +/** + * Created by Sergiu Șandor (micku7zu) on 1/27/2017. + * Original idea: https://github.com/gijsroge/tilt.js + * MIT License. + * Version 1.7.0 + */ + +class VanillaTilt { + constructor(element, settings = {}) { + if (!(element instanceof Node)) { + throw ("Can't initialize VanillaTilt because " + element + " is not a Node."); + } + + this.width = null; + this.height = null; + this.clientWidth = null; + this.clientHeight = null; + this.left = null; + this.top = null; + + // for Gyroscope sampling + this.gammazero = null; + this.betazero = null; + this.lastgammazero = null; + this.lastbetazero = null; + + this.transitionTimeout = null; + this.updateCall = null; + this.event = null; + + this.updateBind = this.update.bind(this); + this.resetBind = this.reset.bind(this); + + this.element = element; + this.settings = this.extendSettings(settings); + + this.reverse = this.settings.reverse ? -1 : 1; + this.glare = VanillaTilt.isSettingTrue(this.settings.glare); + this.glarePrerender = VanillaTilt.isSettingTrue(this.settings["glare-prerender"]); + this.fullPageListening = VanillaTilt.isSettingTrue(this.settings["full-page-listening"]); + this.gyroscope = VanillaTilt.isSettingTrue(this.settings.gyroscope); + this.gyroscopeSamples = this.settings.gyroscopeSamples; + + this.elementListener = this.getElementListener(); + + if (this.glare) { + this.prepareGlare(); + } + + if (this.fullPageListening) { + this.updateClientSize(); + } + + this.addEventListeners(); + this.updateInitialPosition(); + } + + static isSettingTrue(setting) { + return setting === "" || setting === true || setting === 1; + } + + /** + * Method returns element what will be listen mouse events + * @return {Node} + */ + getElementListener() { + if (this.fullPageListening) { + return window.document; + } + + if (typeof this.settings["mouse-event-element"] === "string") { + const mouseEventElement = document.querySelector(this.settings["mouse-event-element"]); + + if (mouseEventElement) { + return mouseEventElement; + } + } + + if (this.settings["mouse-event-element"] instanceof Node) { + return this.settings["mouse-event-element"]; + } + + return this.element; + } + + /** + * Method set listen methods for this.elementListener + * @return {Node} + */ + addEventListeners() { + this.onMouseEnterBind = this.onMouseEnter.bind(this); + this.onMouseMoveBind = this.onMouseMove.bind(this); + this.onMouseLeaveBind = this.onMouseLeave.bind(this); + this.onWindowResizeBind = this.onWindowResize.bind(this); + this.onDeviceOrientationBind = this.onDeviceOrientation.bind(this); + + this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind); + this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind); + this.elementListener.addEventListener("mousemove", this.onMouseMoveBind); + + if (this.glare || this.fullPageListening) { + window.addEventListener("resize", this.onWindowResizeBind); + } + + if (this.gyroscope) { + window.addEventListener("deviceorientation", this.onDeviceOrientationBind); + } + } + + /** + * Method remove event listeners from current this.elementListener + */ + removeEventListeners() { + this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind); + this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind); + this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind); + + if (this.gyroscope) { + window.removeEventListener("deviceorientation", this.onDeviceOrientationBind); + } + + if (this.glare || this.fullPageListening) { + window.removeEventListener("resize", this.onWindowResizeBind); + } + } + + destroy() { + clearTimeout(this.transitionTimeout); + if (this.updateCall !== null) { + cancelAnimationFrame(this.updateCall); + } + + this.reset(); + + this.removeEventListeners(); + this.element.vanillaTilt = null; + delete this.element.vanillaTilt; + + this.element = null; + } + + onDeviceOrientation(event) { + if (event.gamma === null || event.beta === null) { + return; + } + + this.updateElementPosition(); + + if (this.gyroscopeSamples > 0) { + this.lastgammazero = this.gammazero; + this.lastbetazero = this.betazero; + + if (this.gammazero === null) { + this.gammazero = event.gamma; + this.betazero = event.beta; + } else { + this.gammazero = (event.gamma + this.lastgammazero) / 2; + this.betazero = (event.beta + this.lastbetazero) / 2; + } + + this.gyroscopeSamples -= 1; + } + + const totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX; + const totalAngleY = this.settings.gyroscopeMaxAngleY - this.settings.gyroscopeMinAngleY; + + const degreesPerPixelX = totalAngleX / this.width; + const degreesPerPixelY = totalAngleY / this.height; + + const angleX = event.gamma - (this.settings.gyroscopeMinAngleX + this.gammazero); + const angleY = event.beta - (this.settings.gyroscopeMinAngleY + this.betazero); + + const posX = angleX / degreesPerPixelX; + const posY = angleY / degreesPerPixelY; + + if (this.updateCall !== null) { + cancelAnimationFrame(this.updateCall); + } + + this.event = { + clientX: posX + this.left, + clientY: posY + this.top, + }; + + this.updateCall = requestAnimationFrame(this.updateBind); + } + + onMouseEnter() { + this.updateElementPosition(); + this.element.style.willChange = "transform"; + this.setTransition(); + } + + onMouseMove(event) { + if (this.updateCall !== null) { + cancelAnimationFrame(this.updateCall); + } + + this.event = event; + this.updateCall = requestAnimationFrame(this.updateBind); + } + + onMouseLeave() { + this.setTransition(); + + if (this.settings.reset) { + requestAnimationFrame(this.resetBind); + } + } + + reset() { + this.event = { + clientX: this.left + this.width / 2, + clientY: this.top + this.height / 2 + }; + + if (this.element && this.element.style) { + this.element.style.transform = `perspective(${this.settings.perspective}px) ` + + `rotateX(0deg) ` + + `rotateY(0deg) ` + + `scale3d(1, 1, 1)`; + } + + this.resetGlare(); + } + + resetGlare() { + if (this.glare) { + this.glareElement.style.transform = "rotate(180deg) translate(-50%, -50%)"; + this.glareElement.style.opacity = "0"; + } + } + + updateInitialPosition() { + if (this.settings.startX === 0 && this.settings.startY === 0) { + return; + } + + this.onMouseEnter(); + + if (this.fullPageListening) { + this.event = { + clientX: (this.settings.startX + this.settings.max) / (2 * this.settings.max) * this.clientWidth, + clientY: (this.settings.startY + this.settings.max) / (2 * this.settings.max) * this.clientHeight + }; + } else { + this.event = { + clientX: this.left + ((this.settings.startX + this.settings.max) / (2 * this.settings.max) * this.width), + clientY: this.top + ((this.settings.startY + this.settings.max) / (2 * this.settings.max) * this.height) + }; + } + + + let backupScale = this.settings.scale; + this.settings.scale = 1; + this.update(); + this.settings.scale = backupScale; + this.resetGlare(); + } + + getValues() { + let x, y; + + if (this.fullPageListening) { + x = this.event.clientX / this.clientWidth; + y = this.event.clientY / this.clientHeight; + } else { + x = (this.event.clientX - this.left) / this.width; + y = (this.event.clientY - this.top) / this.height; + } + + x = Math.min(Math.max(x, 0), 1); + y = Math.min(Math.max(y, 0), 1); + + let tiltX = (this.reverse * (this.settings.max - x * this.settings.max * 2)).toFixed(2); + let tiltY = (this.reverse * (y * this.settings.max * 2 - this.settings.max)).toFixed(2); + let angle = Math.atan2(this.event.clientX - (this.left + this.width / 2), -(this.event.clientY - (this.top + this.height / 2))) * (180 / Math.PI); + + return { + tiltX: tiltX, + tiltY: tiltY, + percentageX: x * 100, + percentageY: y * 100, + angle: angle + }; + } + + updateElementPosition() { + let rect = this.element.getBoundingClientRect(); + + this.width = this.element.offsetWidth; + this.height = this.element.offsetHeight; + this.left = rect.left; + this.top = rect.top; + } + + update() { + let values = this.getValues(); + + this.element.style.transform = "perspective(" + this.settings.perspective + "px) " + + "rotateX(" + (this.settings.axis === "x" ? 0 : values.tiltY) + "deg) " + + "rotateY(" + (this.settings.axis === "y" ? 0 : values.tiltX) + "deg) " + + "scale3d(" + this.settings.scale + ", " + this.settings.scale + ", " + this.settings.scale + ")"; + + if (this.glare) { + this.glareElement.style.transform = `rotate(${values.angle}deg) translate(-50%, -50%)`; + this.glareElement.style.opacity = `${values.percentageY * this.settings["max-glare"] / 100}`; + } + + this.element.dispatchEvent(new CustomEvent("tiltChange", { + "detail": values + })); + + this.updateCall = null; + } + + /** + * Appends the glare element (if glarePrerender equals false) + * and sets the default style + */ + prepareGlare() { + // If option pre-render is enabled we assume all html/css is present for an optimal glare effect. + if (!this.glarePrerender) { + // Create glare element + const jsTiltGlare = document.createElement("div"); + jsTiltGlare.classList.add("js-tilt-glare"); + + const jsTiltGlareInner = document.createElement("div"); + jsTiltGlareInner.classList.add("js-tilt-glare-inner"); + + jsTiltGlare.appendChild(jsTiltGlareInner); + this.element.appendChild(jsTiltGlare); + } + + this.glareElementWrapper = this.element.querySelector(".js-tilt-glare"); + this.glareElement = this.element.querySelector(".js-tilt-glare-inner"); + + if (this.glarePrerender) { + return; + } + + Object.assign(this.glareElementWrapper.style, { + "position": "absolute", + "top": "0", + "left": "0", + "width": "100%", + "height": "100%", + "overflow": "hidden", + "pointer-events": "none" + }); + + Object.assign(this.glareElement.style, { + "position": "absolute", + "top": "50%", + "left": "50%", + "pointer-events": "none", + "background-image": `linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)`, + "width": `${this.element.offsetWidth * 2}px`, + "height": `${this.element.offsetWidth * 2}px`, + "transform": "rotate(180deg) translate(-50%, -50%)", + "transform-origin": "0% 0%", + "opacity": "0", + }); + } + + updateGlareSize() { + if (this.glare) { + Object.assign(this.glareElement.style, { + "width": `${this.element.offsetWidth * 2}`, + "height": `${this.element.offsetWidth * 2}`, + }); + } + } + + updateClientSize() { + this.clientWidth = window.innerWidth + || document.documentElement.clientWidth + || document.body.clientWidth; + + this.clientHeight = window.innerHeight + || document.documentElement.clientHeight + || document.body.clientHeight; + } + + onWindowResize() { + this.updateGlareSize(); + this.updateClientSize(); + } + + setTransition() { + clearTimeout(this.transitionTimeout); + this.element.style.transition = this.settings.speed + "ms " + this.settings.easing; + if (this.glare) this.glareElement.style.transition = `opacity ${this.settings.speed}ms ${this.settings.easing}`; + + this.transitionTimeout = setTimeout(() => { + this.element.style.transition = ""; + if (this.glare) { + this.glareElement.style.transition = ""; + } + }, this.settings.speed); + + } + + /** + * Method return patched settings of instance + * @param {boolean} settings.reverse - reverse the tilt direction + * @param {number} settings.max - max tilt rotation (degrees) + * @param {startX} settings.startX - the starting tilt on the X axis, in degrees. Default: 0 + * @param {startY} settings.startY - the starting tilt on the Y axis, in degrees. Default: 0 + * @param {number} settings.perspective - Transform perspective, the lower the more extreme the tilt gets + * @param {string} settings.easing - Easing on enter/exit + * @param {number} settings.scale - 2 = 200%, 1.5 = 150%, etc.. + * @param {number} settings.speed - Speed of the enter/exit transition + * @param {boolean} settings.transition - Set a transition on enter/exit + * @param {string|null} settings.axis - What axis should be disabled. Can be X or Y + * @param {boolean} settings.glare - What axis should be disabled. Can be X or Y + * @param {number} settings.max-glare - the maximum "glare" opacity (1 = 100%, 0.5 = 50%) + * @param {boolean} settings.glare-prerender - false = VanillaTilt creates the glare elements for you, otherwise + * @param {boolean} settings.full-page-listening - If true, parallax effect will listen to mouse move events on the whole document, not only the selected element + * @param {string|object} settings.mouse-event-element - String selector or link to HTML-element what will be listen mouse events + * @param {boolean} settings.reset - false = If the tilt effect has to be reset on exit + * @param {gyroscope} settings.gyroscope - Enable tilting by deviceorientation events + * @param {gyroscopeSensitivity} settings.gyroscopeSensitivity - Between 0 and 1 - The angle at which max tilt position is reached. 1 = 90deg, 0.5 = 45deg, etc.. + * @param {gyroscopeSamples} settings.gyroscopeSamples - How many gyroscope moves to decide the starting position. + */ + extendSettings(settings) { + let defaultSettings = { + reverse: false, + max: 15, + startX: 0, + startY: 0, + perspective: 1000, + easing: "cubic-bezier(.03,.98,.52,.99)", + scale: 1, + speed: 300, + transition: true, + axis: null, + glare: false, + "max-glare": 1, + "glare-prerender": false, + "full-page-listening": false, + "mouse-event-element": null, + reset: true, + gyroscope: true, + gyroscopeMinAngleX: -45, + gyroscopeMaxAngleX: 45, + gyroscopeMinAngleY: -45, + gyroscopeMaxAngleY: 45, + gyroscopeSamples: 10 + }; + + let newSettings = {}; + for (var property in defaultSettings) { + if (property in settings) { + newSettings[property] = settings[property]; + } else if (this.element.hasAttribute("data-tilt-" + property)) { + let attribute = this.element.getAttribute("data-tilt-" + property); + try { + newSettings[property] = JSON.parse(attribute); + } catch (e) { + newSettings[property] = attribute; + } + + } else { + newSettings[property] = defaultSettings[property]; + } + } + + return newSettings; + } + + static init(elements, settings) { + if (elements instanceof Node) { + elements = [elements]; + } + + if (elements instanceof NodeList) { + elements = [].slice.call(elements); + } + + if (!(elements instanceof Array)) { + return; + } + + elements.forEach((element) => { + if (!("vanillaTilt" in element)) { + element.vanillaTilt = new VanillaTilt(element, settings); + } + }); + } +} + +if (typeof document !== "undefined") { + /* expose the class to window */ + window.VanillaTilt = VanillaTilt; + + /** + * Auto load + */ + VanillaTilt.init(document.querySelectorAll("[data-tilt]")); +} + +return VanillaTilt; + +}());