您的位置:

CSS Bounce Out 动画效果

一、项目简介

CSS Bounce Out 动画效果是一种比较流行的CSS动画效果之一。该效果的出现可以使得网页在视觉上变得更加生动有趣,同时也能够为网页带来一些视差效果,吸引用户的注意力,提高用户的浏览体验。

二、如何实现CSS Bounce Out动画效果

这里介绍一种使用CSS3实现Bounce Out动画效果的方法,具体步骤如下:

1、编写基础代码

首先,在HTML页面上创建一个div标签,并且给定一个CSS类名,例如:bounce-out

  <div class="bounce-out"></div>

2、设置基础样式

给bounce-out类设置基础样式,例如设置宽度、高度、背景颜色等属性。

  .bounce-out {
    width: 100px;
    height: 100px;
    background-color: #f00;
  }

3、设置动画关键帧

设置bounce-out动画关键帧,分别设置它的起始位置、结束位置和过渡状态。这里采用了bounceOut的动效库。

@keyframes bounceOut {
  0% {
    transform: scale(0.9);
  }

  20%,
  50%,
  55%,
  80%,
  100% {
    transform: scale(1);
  }

  40%,
  45% {
    transform: translate3d(0, -30px, 0);
  }

  60%,
  65% {
    opacity: 1;
    transform: translate3d(0, -15px, 0);
  }

  75% {
    transform: translate3d(0, -4px, 0);
  }
}

4、添加动画效果

最后,在bounce-out类中添加动画效果,并设置动画播放的时长。这里使用了上述定义好的keyframes属性,以及animation属性来完成Bounce Out动画效果。

.bounce-out {
  animation: bounceOut 0.75s;
}

三、Bounce Out动画效果使用场景

Bounce Out动画效果通常可以用来为某些元素添加动态效果,例如页面中的按钮、菜单、弹出层等。这些元素往往需要在用户与之进行交互时进行动画效果的呈现,以突出它们的重要性和特殊性。

四、动画效果展示

下面是一个展示Bounce Out动画效果的示例代码:

  <div class="bounce-out"></div>

  .bounce-out {
    width: 100px;
    height: 100px;
    background-color: #f00;
    animation: bounceOut 0.75s;
  }
  
  @keyframes bounceOut {
    0% {
      transform: scale(0.9);
    }

    20%,
    50%,
    55%,
    80%,
    100% {
      transform: scale(1);
    }

    40%,
    45% {
      transform: translate3d(0, -30px, 0);
    }

    60%,
    65% {
      opacity: 1;
      transform: translate3d(0, -15px, 0);
    }

    75% {
      transform: translate3d(0, -4px, 0);
    }
  }
CSS Bounce Out 动画效果

2023-05-12
CSS Bounce Up

2023-05-12
CSS Bounce Effect

2023-05-12
CSS移动效果

2023-05-12
CSS Bounce Expression in After

2023-05-12
CSS动画实现图片弹跳效果

2023-05-12
CSS实现弹跳效果

2023-05-12
CSS弹跳动画

2023-05-12
CSS与After Effects结合实现弹跳效果

2023-05-12
如何制作CSS图片反弹动画效果

2023-05-12
如何实现元素的弹跳动画效果

2023-05-12
when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${item.id} [in template "article/detail/index.ftl" at line 48, column 106] ---- Java stack trace (for programmers): ---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481) at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401) at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370) at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:104) at freemarker.core.DollarVariable.accept(DollarVariable.java:63) at freemarker.core.Environment.visit(Environment.java:371) at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:321) at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271) at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244) at freemarker.core.Environment.visitIteratorBlock(Environment.java:645) at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:335) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.visit(Environment.java:341) at freemarker.core.Environment.process(Environment.java:314) at freemarker.template.Template.process(Template.java:383) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:332) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.doRender(FreeMarkerView.java:266) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.renderMergedTemplateModel(FreeMarkerView.java:220) at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:181) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:314) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1431) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1167) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1106) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at com.software.filter.HttpSpiderIdentifyFilter.doFilter(HttpSpiderIdentifyFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)