国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

使用 electron 實現(xiàn)類似新版 QQ 的登錄界面效果(陰影、背景動畫、窗體3D翻轉(zhuǎn))

來源:懂視網(wǎng) 責編:小采 時間:2020-11-27 22:05:57
文檔

使用 electron 實現(xiàn)類似新版 QQ 的登錄界面效果(陰影、背景動畫、窗體3D翻轉(zhuǎn))

使用 electron 實現(xiàn)類似新版 QQ 的登錄界面效果(陰影、背景動畫、窗體3D翻轉(zhuǎn)):現(xiàn)在什么都講究追趕潮流,覺得 QQ 登錄窗口做的效果不錯,既然剛學習 electron ,那么就用 electron 模仿一下。其實主要用到的就是 CSS3 的效果:邊框圓角、陰影,3D變換。對,就這么簡單。先上效果: 下面是關(guān)鍵代碼: app.js 'use st
推薦度:
導讀使用 electron 實現(xiàn)類似新版 QQ 的登錄界面效果(陰影、背景動畫、窗體3D翻轉(zhuǎn)):現(xiàn)在什么都講究追趕潮流,覺得 QQ 登錄窗口做的效果不錯,既然剛學習 electron ,那么就用 electron 模仿一下。其實主要用到的就是 CSS3 的效果:邊框圓角、陰影,3D變換。對,就這么簡單。先上效果: 下面是關(guān)鍵代碼: app.js 'use st

現(xiàn)在什么都講究追趕潮流,覺得 QQ 登錄窗口做的效果不錯,既然剛學習 electron ,那么就用 electron 模仿一下。其實主要用到的就是 CSS3 的效果:邊框圓角、陰影,3D變換。對,就這么簡單。先上效果:

下面是關(guān)鍵代碼:

app.js

'use strict';
const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win
function createWindow() {
 // Create the browser window.
 win = new BrowserWindow({
 width: 495, height: 470, /*skipTaskbar: true,*/ frame: false,
 resizable: false, transparent: true, show: false, alwaysOnTop: true
 })
 win.once('ready-to-show', () => {
 win.show()
 })
 // and load the index.html of the app.
 win.loadURL(url.format({
 pathname: path.join(__dirname, '/app/index.html'),
 protocol: 'file:',
 slashes: true
 }))
 // Open the DevTools.
 //win.webContents.openDevTools()
 // Emitted when the window is closed.
 win.on('closed', () => {
 // Dereference the window object, usually you would store windows
 // in an array if your app supports multi windows, this is the time
 // when you should delete the corresponding element.
 win = null
 })
}
//app.disableHardwareAcceleration();
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', () => {
 // On macOS it is common for applications and their menu bar
 // to stay active until the user quits explicitly with Cmd + Q
 if (process.platform !== 'darwin') {
 app.quit()
 }
})
app.on('activate', () => {
 // On macOS it's common to re-create a window in the app when the
 // dock icon is clicked and there are no other windows open.
 if (win === null) {
 createWindow()
 }
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

index.html

<!DOCTYPE html>
<html style="margin:0; padding:0;height:100%;">
<head>
 <meta charset="UTF-8">
 <title>QQ Login</title>
 <style>
 html, body {
 margin: 0;
 padding: 0;
 width: 100%;
 height: 100%;
 }

 body {
 perspective: 800px;
 -webkit-app-region: drag;
 -webkit-user-select: none;
 }

 input[type="submit"],
 input[type="reset"],
 input[type="button"],
 input[type="text"],
 button,
 textarea {
 -webkit-app-region: no-drag;
 }

 .shadow {
 box-shadow: 0 0 10px rgba(0, 0, 0, 1);
 position: absolute;
 width: 100%;
 height: 100%;
 border-radius: 4px;
 }

 #login-back {
 position: relative;
 border-radius: 3px 3px 0 0;
 left: 0;
 right: 0;
 height: 180px;
 }

 #card {
 left: 33px;
 top: 70px;
 right: 33px;
 bottom: 70px;
 background-color: #ebf2f9;
 position: absolute;
 -webkit-transition: -webkit-transform .6s ease-in-out;
 transition: transform .6s ease-in-out;
 -webkit-transform-style: preserve-3d;
 transform-style: preserve-3d;
 border-radius: 4px;
 }

 #card.flipped {
 -webkit-transform: rotateY( 180deg );
 transform: rotateY( 180deg );
 }

 #card .front {
 background: url(imgs/login-back.gif) no-repeat;
 background-size: 100% 180px;
 position: absolute;
 transform: rotateY(0deg);
 }

 #card .back {
 position: absolute;
 background: url(imgs/login-back.gif) no-repeat;
 background-size: 100% 180px;
 -webkit-transform: rotateY( -180deg );
 transform: rotateY( -180deg );
 -webkit-backface-visibility: hidden;
 backface-visibility: hidden;
 z-index:2;
 }

 .sys-control-box {
 float:right;
 width:84px;
 border-radius: 0 3px 0 0;
 }

 .sys-btn {
 width: 28px;
 height: 28px;
 border: none;
 outline: none;
 margin: 0;
 }

 .sys-btn-mini {
 background: url(imgs/btn_mini_normal.png) no-repeat;
 }

 .sys-btn-mini:hover {
 background: url(imgs/btn_mini_highlight.png) no-repeat;
 }

 .sys-btn-mini:active {
 background: url(imgs/btn_mini_down.png) no-repeat;
 }

 .sys-btn-close {
 border-radius: 0 3px 0 0;
 background: url(imgs/btn_close_normal.png) no-repeat;
 }

 .sys-btn-close:hover {
 background: url(imgs/btn_close_highlight.png) no-repeat;
 }

 .sys-btn-close:active {
 background: url(imgs/btn_close_down.png) no-repeat;
 }

 .sys-btn-set {
 background: url(imgs/btn_set_normal.png) 1px 0 no-repeat;
 }

 .sys-btn-set:hover {
 background: url(imgs/btn_set_hover.png) 1px 0 no-repeat;
 }

 .sys-btn-set:active {
 background: url(imgs/btn_set_press.png) 1px 0 no-repeat;
 }

 .btn {
 width: 78px;
 height: 28px;
 background: url(imgs/setting_btn_normal.png) no-repeat;
 background-size: 100% 100%;
 border: none;
 outline: none;
 margin: 0;
 }

 .btn:hover, .btn:active {
 background: url(imgs/setting_btn_hover.png) no-repeat;
 background-size: 100% 100%;
 }

 .btn:focus {
 background: url(imgs/setting_btn_hover.png) no-repeat;
 background-size: 100% 100%;
 }
 </style>
</head>
<body>
 <div id="card">
 <div id="front" class="front shadow">
 <div class="sys-control-box">
 <button id="btn-set" class="sys-btn sys-btn-set" title="設置"></button><button class="sys-btn sys-btn-mini" title="最小化"></button><button class="sys-btn sys-btn-close" title="關(guān)閉"></button>
 </div>
 </div>
 <div id="back" class="back shadow">
 <div style="width:100%;height:100%; border-radius: 4px;background:-webkit-linear-gradient(top, rgba(0, 0, 0, 0.00) 0%, rgba(0, 0, 0, 0.00) 6%, #ebf2f9 12%, #ebf2f9 90%, #cde2f2 90%, #cde2f2 100%);">
 <div class="sys-control-box" style="width:56px;">
 <button class="sys-btn sys-btn-mini" title="最小化"></button><button class="sys-btn sys-btn-close" title="關(guān)閉"></button>
 </div>
 <button id="btn-ok" style="position:absolute; right:91px; bottom:2px;" class="btn">確定</button>
 <button id="btn-cancel" style="position:absolute; right:10px; bottom:2px;" class="btn">取消</button>
 </div>
 </div>
 </div>
 <script>
 Element.prototype.hasClassName = function (a) {
 return new RegExp("(?:^|\\s+)" + a + "(?:\\s+|$)").test(this.className);
 };

 Element.prototype.addClassName = function (a) {
 if (!this.hasClassName(a)) {
 this.className = [this.className, a].join(" ");
 }
 };

 Element.prototype.removeClassName = function (b) {
 if (this.hasClassName(b)) {
 var a = this.className;
 this.className = a.replace(new RegExp("(?:^|\\s+)" + b + "(?:\\s+|$)", "g"), " ");
 }
 };

 Element.prototype.toggleClassName = function (a) {
 this[this.hasClassName(a) ? "removeClassName" : "addClassName"](a);
 };

 //var init = function () {
 // var card = document.getElementById('card');

 // document.getElementById('front').addEventListener('click', function () {
 // card.toggleClassName('flipped');
 // }, false);

 // document.getElementById('back').addEventListener('click', function () {
 // card.toggleClassName('flipped');
 // }, false);
 //};

 //window.addEventListener('DOMContentLoaded', init, false);
 (function () {

 const remote = require('electron').remote;

 function init() {

 function flip() {
 if (frontShow == 2) {
 document.getElementById('front').style.display = 'block';
 }
 else {
 document.getElementById('back').style.display = 'block';
 }
 card.toggleClassName('flipped');
 };

 var btn_minis = document.getElementsByClassName("sys-btn-mini");
 for (var i = 0; i < btn_minis.length; i++) {
 btn_minis[i].addEventListener("click", function (e) {
 const window = remote.getCurrentWindow();
 window.minimize();
 });
 }

 //document.getElementById("sys-btn-maxi").addEventListener("click", function (e) {
 // const window = remote.getCurrentWindow();
 // if (!window.isMaximized()) {
 // window.maximize();
 // } else {
 // window.unmaximize();
 // }
 //});

 var btn_closes = document.getElementsByClassName("sys-btn-close");
 for (var i = 0; i < btn_closes.length; i++) {
 btn_closes[i].addEventListener("click", function (e) {
 const window = remote.getCurrentWindow();
 window.close();
 });
 } 

 var card = document.getElementById('card');
 var frontShow = 1;

 var btn_sets = document.getElementsByClassName("sys-btn-set");
 for (var i = 0; i < btn_sets.length; i++) {
 btn_sets[i].addEventListener('click', function () { flip(); }, false);
 } 

 card.addEventListener('transitionend', function () {
 if (frontShow == 1) {
 frontShow = 2;
 document.getElementById('front').style.display = 'none';
 }
 else {
 document.getElementById('back').style.display = 'none';
 frontShow = 1;
 }
 }, false);

 document.getElementById('btn-ok').addEventListener('click', function () { flip(); }, false);
 document.getElementById('btn-cancel').addEventListener('click', function () { flip(); }, false);
 };

 document.onreadystatechange = function () {
 if (document.readyState == "complete") {
 init();
 }
 };
 })();
 </script>
</body>
</html>

最后整個項目的源代碼:https://github.com/starts2000/ElectronQQLogin

總結(jié)

以上所述是小編給大家介紹的使用 electron 實現(xiàn)類似新版 QQ 的登錄界面效果(陰影、背景動畫、窗體3D翻轉(zhuǎn)),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

使用 electron 實現(xiàn)類似新版 QQ 的登錄界面效果(陰影、背景動畫、窗體3D翻轉(zhuǎn))

使用 electron 實現(xiàn)類似新版 QQ 的登錄界面效果(陰影、背景動畫、窗體3D翻轉(zhuǎn)):現(xiàn)在什么都講究追趕潮流,覺得 QQ 登錄窗口做的效果不錯,既然剛學習 electron ,那么就用 electron 模仿一下。其實主要用到的就是 CSS3 的效果:邊框圓角、陰影,3D變換。對,就這么簡單。先上效果: 下面是關(guān)鍵代碼: app.js 'use st
推薦度:
標簽: QQ 登錄 使用
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 久久国产精品自由自在 | 国产成人一区二区三区在线播放 | 亚洲午夜伦理 | 免费高清欧美大片在线观看 | 夜夜操夜夜 | 国产一区二区三区高清 | 亚洲视频免费在线观看 | 国产69久久精品成人看小说 | 国产福利一区二区三区在线观看 | 91精品国产91久久久久久 | 亚洲一区二区三区成人 | 欧美成人一区二区三区 | 亚洲a∨精品一区二区三区下载 | 午夜看一级特黄a大片黑 | 国产精品手机视频一区二区 | 国产免费一区二区三区 | 久久亚洲精品国产亚洲老地址 | 国产成人高清亚洲一区久久 | 日韩在线视频播放 | 国产亚洲一区二区精品 | 久久亚洲精选 | 性xxxxfreexxxxx国产 | 99热成人精品免费久久 | 亚洲精品99久久久久中文字幕 | 2021国产成人精品久久 | 北条麻妃国产九九九精品视频 | 一级毛片免费看 | 中文字幕有码在线播放 | 欧美一区二区三区视视频 | 久久久一区二区三区不卡 | 国产中文字幕在线 | 国产日韩一区二区三区在线观看 | 国产精品久久久久久久久免费 | 欧美精品亚洲精品日韩专区va | 精品一区二区三区免费毛片爱 | 久久亚洲一级α片 | 成人国产在线看不卡 | 在线观看欧美国产 | 日本黄 色 成 年 人免费观看 | 国产美女啪啪 | 中文国产成人精品久久久 |