编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

CSS3动画解析抖音 LOGO制作(抖音logo效果制作)

wxchong 2024-08-09 11:34:43 开源技术 19 ℃ 0 评论

点击右上方红色按钮关注“web秀”,让你真正秀起来

前言

“字节跳动”现今也是如日中天,旗下产品,除头条外,还有短视频平台“抖音”,人气也是非常高,据说拥有7亿用户。

今天我们就来研究研究抖音的logo,蹭蹭热度。

效果预览:

主要用css3新增属性mix-blend-mode,混合模式来实现。

分解

我们先来看看它的组成,由大写的“J”组成,然后有3种颜色,白色、红色、和天蓝色。

ok,我们先来完成一个“J”。根据以往的经验,我们把它拆分成3部分。

下面我们来分步骤实现。

完成单个“J”

<div class="jitter"> 
 <div class="logo"></div> 
</div>

添加样式

.jitter { 
 position: relative; 
 width: 200px; 
 margin: 100px auto; 
} 
 
// 第一部分 
.logo { 
 position: absolute; 
 top: 0; 
 left: 0; 
 width: 47px; 
 height: 218px; 
 z-index: 1; 
 background: #24f6f0; 
} 
// 第二部分 
.logo::after { 
 content: ""; 
 position: absolute; 
 width: 140px; 
 height: 140px; 
 border: 40px solid #24f6f0; 
 border-right: 40px solid transparent; 
 border-top: 40px solid transparent; 
 border-left: 40px solid transparent; 
 top: -110px; 
 right: -183px; 
 border-radius: 100%; 
 transform: rotate(45deg); 
 z-index: -10; 
} 
// 第三部分 
.logo::before { 
 content: ""; 
 position: absolute; 
 width: 100px; 
 height: 100px; 
 border: 47px solid #24f6f0; 
 border-top: 47px solid transparent; 
 border-radius: 50%; 
 top: 121px; 
 left: -147px; 
 transform: rotate(45deg); 
}

第一部分,就是个矩形 第二部分,是圆环的1/4 第三部分,是圆环的3/4

添加另外一个“J”

<div class="jitter"> 
 <div class="logo"></div> 
 <div class="logo"></div> 
</div>

样式只需要添加

... 
// 省略上面的样式 
... 
// 和第一个J错开10px 
.logo:last-child { 
 left: 10px; 
 top: 10px; 
 background: #fe2d52; 
 z-index: 100; 
} 
// 填充红色 
.logo:last-child::before { 
 border: 47px solid #fe2d52; 
 border-top: 47px solid transparent; 
} 
.logo:last-child::after { 
 border: 40px solid #fe2d52; 
 border-right: 40px solid transparent; 
 border-top: 40px solid transparent; 
 border-left: 40px solid transparent; 
}

主角登场 - mix-blend-mode

CSS3 新增了一个很有意思的属性 -- mix-blend-mode ,其中 mix 和 blend 的中文意译均为混合,那么这个属性的作用直译过来就是混合混合模式,当然,我们我们通常称之为混合模式。

混合模式最常见于 photoshop 中,是 PS 中十分强大的功能之一。下面来看看mix-blend-mode有哪些属性可以设置:

mix-blend-mode: normal; // 正常 
mix-blend-mode: multiply; // 正片叠底 
mix-blend-mode: screen; // 滤色 
mix-blend-mode: overlay; // 叠加 
mix-blend-mode: darken; // 变暗 
mix-blend-mode: lighten; // 变亮 
mix-blend-mode: color-dodge; // 颜色减淡 
mix-blend-mode: color-burn; // 颜色加深 
mix-blend-mode: hard-light; // 强光 
mix-blend-mode: soft-light; // 柔光 
mix-blend-mode: difference; // 差值 
mix-blend-mode: exclusion; // 排除 
mix-blend-mode: hue; // 色相 
mix-blend-mode: saturation; // 饱和度 
mix-blend-mode: color; // 颜色 
mix-blend-mode: luminosity; // 亮度 
 
mix-blend-mode: initial; 
mix-blend-mode: inherit; 
mix-blend-mode: unset;

然后我们添加mix-blend-mode:lighten

.logo:last-child { 
 ... 
 mix-blend-mode: lighten; 
}

看看效果:

是不是很Ok了?

然后我们添加动画,让第二个J缓慢和一个J融合。

动画融合

.logo:last-child { 
 ... 
 animation: move 10s infinite; 
} 
@keyframes move { 
 0% { 
 transform: translate(200px); 
 } 
 50% { 
 transform: translate(0px); 
 } 
 100% { 
 transform: translate(0px); 
 } 
}

最终就可以实现第一张图片的预览效果了。

公告

喜欢小编的点击关注,了解更多知识!

源码地址请点击下方“了解更多”

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表