Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Reveal Effect #2 (CSS)
Delay type
Random
Go
css
@import url("https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css"); @import url("https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css"); @import url("https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css"); body { margin: 0; width: 100%; height: 100%; } #page { visibility: hidden; } #reveal { position: fixed; z-index: 1; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; } #app.loaded .v-application { background-image: radial-gradient(circle, #73aad6, #003962, #000); } #app.loaded #page { visibility: visible; } #app.loaded #reveal { opacity: 1; } #app.revealed #reveal { display: none; } #reveal > div { position: absolute; background-color: #fff; animation-fill-mode: forwards; } #reveal > .circle { border-radius: 50%; } .custom1 { animation-name: custom1; animation-timing-function: ease-in; } @keyframes custom1 { from { opacity: 1; transform: scale3d(1, 1, 1) translate3d(0, 0, 0); } to { opacity: 0; transform: scale3d(0.2, 0.2, 0.2) translate3d(150px, -100px, 0); } }
JavaScript
const { random: rnd, floor, ceil, sqrt } = Math; new Vue({ el: '#app', vuetify: new Vuetify(), data: { elements: [], shape: 'circle', shapes: ['square', 'circle'], shapeSize: 50, shapeRadius: 50, anim: 'zoomOut', animDuration: 2.5, animDurationRnd: false, animDelay: 2.5, delayType: 'radial1', delayTypes: [ { value: 'horizontal', text: 'Horizontal' }, { value: 'radial1', text: 'Radial' }, { value: 'radial2', text: 'Radial (inverse)' }, { value: 'random', text: 'Random' }, { value: 'vertical', text: 'Vertical' }, ], anims: [ 'custom1', 'bounceOut', 'zoomOut', 'zoomOutDown', 'zoomOutLeft', 'zoomOutRight', 'zoomOutUp', 'fadeOut', 'fadeOutDown', 'fadeOutLeft', 'fadeOutRight', 'fadeOutUp', 'flipOutX', 'flipOutY', 'lightSpeedOut', 'rotateOut', 'rotateOutDownLeft', 'rotateOutDownRight', 'rotateOutUpLeft', 'rotateOutUpRight', 'rollOut', ], randomColors: true, loaded: false, revealed: false, width: 0, height: 0, cx: 0, cy: 0, nx: 0, ny: 0 }, mounted() { this.onResize(); window.addEventListener('resize', this.onResize); this.revealEffect(); }, methods: { revealEffect() { this.loaded = false; this.revealed = false; this.shapeRadius = this.shapeSize * (1 + sqrt(2) / 2); this.nx = ceil(this.width / this.shapeSize)+1; this.ny = ceil(this.height / this.shapeSize)+1; this.animCount = this.nx * this.ny; this.elements = []; for (let i = 0; i < this.nx; i++) { for (let j = 0; j < this.ny; j++) { const x = i * this.shapeSize; const y = j * this.shapeSize; const duration = this.animDurationRnd ? rnd() * this.animDuration : this.animDuration; const el = { x, y, duration, delay: this.delay(i, j, x, y), anim: this.anim, shape: this.shape }; el.style = this.getStyle(el); this.elements.push(el); } } if (this.randomColors) { setTimeout(() => { const cscale = chroma.scale([chroma.random(), chroma.random()]);//.mode('lch'); this.elements.forEach(el => { el.style = { ...el.style, 'background-color': cscale(rnd()) }; }); }, 150); } this.loaded = true; }, randomEffect() { this.shape = this.shapes[floor(rnd() * this.shapes.length)]; this.shapeSize = 50 + rnd() * 50; this.anim = this.anims[floor(rnd() * this.anims.length)]; this.animDuration = 1.5 + rnd() * 3; this.animDurationRnd = rnd() > 0.7; this.animDelay = 1.5 + rnd() * 2; this.delayType = this.delayTypes[floor(rnd() * this.delayTypes.length)].value; this.randomColors = rnd() > 0.4; this.revealEffect(); }, animationend(e) { if (--this.animCount==0) { this.revealed = true; this.elements = []; } }, getStyle(el) { const style = {}; let x = el.x - 1; let y = el.y - 1; let w = this.shapeSize + 2, h = w; if (this.shape=='circle') { x -= this.shapeSize * 0.5 * sqrt(2); y -= this.shapeSize * 0.5 * sqrt(2); w = this.shapeRadius + 2; h = w; } style.left = x + 'px'; style.top = y + 'px'; style.width = w + 'px'; style.height = h + 'px'; style['animation-duration'] = el.duration + 's'; style['animation-delay'] = el.delay + 's'; if (this.randomColors) { style['transition-property'] = 'background-color'; style['transition-delay'] = (el.delay - 0.15) + 's'; style['transition-duration'] = (el.duration - 0.15) + 's'; } return style; }, delay(i, j, x, y) { let delay = 0, dx, dy, d, max; switch (this.delayType) { case 'horizontal': delay = (i*this.ny+j) * this.animDelay / 500; break; case 'radial1': dx = x - this.cx + this.shapeSize/2; dy = y - this.cy + this.shapeSize/2; d = Math.sqrt(dx*dx + dy*dy); delay = d * this.animDelay / 500; break; case 'radial2': max = Math.sqrt(this.cx*this.cx + this.cy*this.cy); dx = x - this.cx + this.shapeSize/2; dy = y - this.cy + this.shapeSize/2; d = max - Math.sqrt(dx*dx + dy*dy); delay = d * this.animDelay / 500; break; case 'vertical': delay = (j*this.nx+i) * this.animDelay / 500; break; default: delay = Math.random() * this.animDelay; break; } return delay + 0.4; }, onResize() { this.width = window.innerWidth; this.height = window.innerHeight; this.cx = this.width / 2; this.cy = this.height / 2; } } });
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>页面过渡动画效果(CSS/VueJS)-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号