国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

Vue實(shí)現(xiàn)牌面翻轉(zhuǎn)效果

瀏覽:30日期:2022-09-28 09:53:24

本文實(shí)例為大家分享了Vue實(shí)現(xiàn)牌面翻轉(zhuǎn)效果的具體代碼,供大家參考,具體內(nèi)容如下

1.實(shí)現(xiàn)效果

實(shí)現(xiàn)一個點(diǎn)擊沿中心Y軸翻轉(zhuǎn)的翻轉(zhuǎn)效果。

Vue實(shí)現(xiàn)牌面翻轉(zhuǎn)效果

2.方法

分前(front)、后(behind)兩部分,behind的div通過css布局設(shè)定為將其翻轉(zhuǎn)180度在front的div后面隱藏不顯示,點(diǎn)擊執(zhí)行翻轉(zhuǎn)動畫,在執(zhí)行翻轉(zhuǎn)動畫的時候設(shè)置behind的div顯示,之后將front的div隱藏.依次反復(fù)。

3.具體代碼

<template><div id='try'> <!-- box_rolling下執(zhí)行正面翻轉(zhuǎn)動畫 --><div : @click='isRolling = !isRolling'> <!-- 前面div --> <div class='rollbox_front'> <div class='contentbox'> <img src='http://www.intensediesel.com/bcjs/@/assets/images/s1.png'/> </div> </div> <!-- 后面div --> <div class='rollbox_behind'> <div class='contentbox'> <img src='http://www.intensediesel.com/bcjs/@/assets/images/s2.png'/> </div> </div></div></div></template><script>export default{ name:’try’, data(){ return{ isRolling:false } }}</script><style lang=’scss’>#try{ .rollbox{ position: relative; perspective: 1000px; width:200px; height: 400px; margin:100px auto; &_front, &_behind{ transform-style: preserve-3d; //表示所有子元素在3D空間中呈現(xiàn) backface-visibility: hidden; //元素背面向屏幕時是否可見transition-duration:.5s; transition-timing-function:’ease-in’; background:#008080; .contentbox{ width:200px; height: 400px; display: flex; justify-content: center; align-items: center; >img{ width:100px; } } } &_behind{ transform: rotateY(180deg); visibility:hidden; //元素不可見,但占據(jù)空間 position: absolute; top:0; bottom:0; right: 0; left: 0; } } .box_rolling{ .rollbox_front{ transform: rotateY(180deg); visibility:hidden; } .rollbox_behind{ transform: rotateY(360deg); visibility:visible; } }}</style>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 荔浦县| 山阴县| 阳新县| 阿巴嘎旗| 永靖县| 蕲春县| 通州区| 七台河市| 江山市| 武汉市| 嘉峪关市| 密山市| 长沙县| 隆安县| 大安市| 宜川县| 高要市| 临澧县| 武功县| 建平县| 兖州市| 类乌齐县| 泸州市| 台东县| 平和县| 南安市| 阳新县| 寿宁县| 北票市| 深州市| 河津市| 安顺市| 嘉禾县| 新田县| 应用必备| 仁布县| 铅山县| 永善县| 闻喜县| 遂川县| 汤阴县|