网页设计怎么分析网站啊,网站推广途径和推广要点的案例讨论,西安企业培训,word 关于做网站在 Vue 开发中#xff0c;我们可以利用transition组件来打造各种令人惊艳的动画效果。下面来详细看看这些有趣的动画效果及其实现代码。
一、缩放类效果
zoom-in#xff08;整体放大进入#xff09;
templatedivbutton clickisShow ! …在 Vue 开发中我们可以利用transition组件来打造各种令人惊艳的动画效果。下面来详细看看这些有趣的动画效果及其实现代码。
一、缩放类效果
zoom-in整体放大进入
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namezoom-inh1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.zoom-in-enter-active {animation: zoomIn 0.5s ease;
}keyframes zoomIn {from {transform: scale(0);}to {transform: scale(1);}
}
/stylezoom-in-left从左侧放大进入
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namezoom-in-lefth1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.zoom-in-left-enter-active {animation: zoomInLeft 0.5s ease;
}keyframes zoomInLeft {from {transform: scale(0) translateX(-100%);}to {transform: scale(1) translateX(0);}
}
/stylezoom-in-right从右侧放大进入
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namezoom-in-righth1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.zoom-in-right-enter-active {animation: zoomInRight 0.5s ease;
}keyframes zoomInRight {from {transform: scale(0) translateX(100%);}to {transform: scale(1) translateX(0);}
}
/stylezoom-in-top从顶部放大进入
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namezoom-in-toph1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.zoom-in-top-enter-active {animation: zoomInTop 0.5s ease;
}keyframes zoomInTop {from {transform: scale(0) translateY(-100%);}to {transform: scale(1) translateY(0);}
}
/stylezoom-in-bottom从底部放大进入
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namezoom-in-bottomh1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.zoom-in-bottom-enter-active {animation: zoomInBottom 0.5s ease;
}keyframes zoomInBottom {from {transform: scale(0) translateY(100%);}to {transform: scale(1) translateY(0);}
}
/stylezoom-in-center-x沿水平中心轴放大进入
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namezoom-in-center-xh1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.zoom-in-center-x-enter-active {animation: zoomInCenterX 0.5s ease;
}keyframes zoomInCenterX {from {transform: scaleX(0);}to {transform: scaleX(1);}
}
/stylezoom-in-center-y沿垂直中心轴放大进入
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namezoom-in-center-yh1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.zoom-in-center-y-enter-active {animation: zoomInCenterY 0.5s ease;
}keyframes zoomInCenterY {from {transform: scaleY(0);}to {transform: scaleY(1);}
}
/style二、滑动类效果
slide普通滑动
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition nameslideh1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.slide-enter-active {animation: slideIn 0.5s ease;
}keyframes slideIn {from {transform: translateX(-100%);}to {transform: translateX(0);}
}
/styleslide-left向左滑动
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition nameslide-lefth1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {name: Test,data() {return {isShow: true,};},
};
/scriptstyle scoped
.slide-left-enter-active {animation: slideLeftIn 0.5s ease;
}keyframes slideLeftIn {from {transform: translateX(100%);}to {transform: translateX(0);}
}
/style向右滑动slide-right
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition nameslide-righth1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {data() {return {isShow: false};}
};
/scriptstyle scoped
.slide-right-enter-active,
.slide-right-leave-active {transition: all 0.5s ease;
}.slide-right-enter,
.slide-right-leave-to {transform: translateX(-100%);
}
/style向上滑动slide-top
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition nameslide-toph1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {data() {return {isShow: false};}
};
/scriptstyle scoped.slide-top-enter-active,.slide-top-leave-active {transition: all 0.5s ease;}.slide-top-enter,.slide-top-leave-to {transform: translateY(-100%);}
/style向下滑动slide-bottom
templatediv classslide-bottom-animation v-ifshowBottom向下滑动示例/div
/templatescript
export default {data() {return {showBottom: false};}
};
/scriptstyle scoped.slide-bottom-enter-active,.slide-bottom-leave-active {transition: all 0.5s ease;}.slide-bottom-enter,.slide-bottom-leave-to {transform: translateY(100%);}/style三、淡入淡出效果
templatedivbutton clickisShow ! isShow显示/隐藏/buttontransition namefade-animationh1 v-showisShow你好啊/h1/transition/div
/templatescript
export default {data() {return {isShow: true};}
};
/scriptstyle scoped
.fade-animation-enter-active,
.fade-animation-leave-active {transition: opacity 0.5s ease;
}.fade-animation-enter,
.fade-animation-leave-to {opacity: 0;
}
/style