简体   繁体   English

如何使用css和js创建被动波浪效果按钮

[英]How to create a passive wave effect button using css and js

I know that there are lot of questions similar to this but what I want is more particular.我知道有很多类似的问题,但我想要的是更具体的。

I came up on a site recently and I really want to know the code how to create similar button wave effect.我最近访问了一个网站,我真的很想知道如何创建类似按钮波浪效果的代码。 This wave effect looks like even the border and text color is changing after every particular interval of time.这种波浪效果看起来甚至边框和文本颜色在每个特定的时间间隔后都会发生变化。

The site i'm talking about is https://www.revcontent.com/ .我正在谈论的网站是https://www.revcontent.com/ The Signup button effect on the navbar is the one which I want.导航栏上的注册按钮效果是我想要的。

注册按钮

And also I want to know one more type of button effect.而且我还想知道另一种类型的按钮效果。

This is something which I wanted to have when CSGO game new template/theme was released.这是我在 CSGO 游戏新模板/主题发布时想要的东西。

CSGO Go 按钮

CSGO Go 按钮

CSGO Go 按钮

CSGO Go 按钮

You mentioned text color is changing after every particular interval of time.您提到text color is changing after every particular interval of time. With CSS animations, you can get a "basic start" down this road.使用 CSS 动画,您可以在这条道路上获得“基本的开始”。

I'm not sure of your level of coding, but take a look at transitions我不确定你的编码水平,但看看转换

To create a transition effect, you must specify two things:要创建过渡效果,您必须指定两件事:

  • the CSS property you want to add an effect to要添加效果的 CSS 属性
  • the duration of the effect效果持续时间

Here is a simple example based on an event (ie someone hovers over it) which then changes its color and size over time.这是一个基于事件的简单示例(即有人悬停在它上面),然后随着时间的推移改变它的颜色和大小。 You can do the same thing and give a similar "illusion" to your original diagram in your post.你可以做同样的事情,并在你的帖子中给你的原始图表一个类似的“错觉”。

The HTML element: HTML 元素:

<span class="slider"></span>

The CSS: CSS:

.slider {
  display: block;
  height: 25px;
  width: 0;
  background-color: black;
  transition: 0.25s ease;
 }

 .slider:hover {
   width: 100%;
   background-color: green;
 }

From this point, explore your CSS options with element colors, the text that is within the element itself, opacity effects, durations, all to come close to what you are showing us in your original diagram.从这一点开始,探索您的 CSS 选项,包括元素颜色、元素本身内的文本、不透明度效果、持续时间,所有这些都接近您在原始图表中向我们展示的内容。 Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM