首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >教你如何用代码表白

教你如何用代码表白

原创
作者头像
被封放走的少年
修改2020-05-25 10:37:12
修改2020-05-25 10:37:12
4K0
举报

1.新建文本

2.将下面的代码复制粘贴

3.将后缀TXT改成html

4.看看效果如何

<!DOCTYPE html>

<html lang="zh-cn">

<head>

<meta charset="UTF-8">

<title>Document</title>

<style>

@keyframes ani{

from{

transform:rotateY(0deg) rotateX(0deg);

}

to{

transform:rotateY(360deg) rotateX(360deg);

}

}

body{

perspective:1000px;

}

#heart{

position:relative;

height:200px;

width:150px;

margin:200px auto;

animation:ani 5s linear infinite;

transform-style:preserve-3d;

}

.line{

position:absolute;

height:200px;

width:150px;

border:2px solid red;

border-left:0;

border-bottom:0;

border-radius:50% 50% 0/50% 40% 0;

}

#word{

font-family:"隶书";

font-size:1.3em;

color:red;

position:absolute;

top: 80px;

left:22px;

font-weight:bold;

}

</style>

</head>

<body>

<div id="heart">

<div id="word">I LOVE You but also best you</div>

</div>

<script>

var heart=document.getElementById("heart");

var html="";

for(var i=0;i<36;i++){

html+="<div class='line' style='transform:rotateY("+i*10+"deg) rotateZ(45deg) translateX(25px)'></div>";

}

heart.innerHTML += html;

</script>

</body>

</html>

3D效果
3D效果

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档