HTML圣诞树代码(动态效果)

2023-12-20 15:36

本文主要是介绍HTML圣诞树代码(动态效果),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

HTML代码过长所以在顶部资源链接可以直接下载

Pug代码:

.main-wrapper.tree-container.star.spiral-containerul.spiral.one- for (var x = 1; x <= 43; x++)li.light-wrapper(class="light-wrapper-" + x).stabilise: .lightul.spiral.two- for (var x = 1; x <= 43; x++)li.light-wrapper(class="light-wrapper-" + x).stabilise: .lightul.spiral.three- for (var x = 1; x <= 43; x++)li.light-wrapper(class="light-wrapper-" + x).stabilise: .lightul.spiral.four- for (var x = 1; x <= 43; x++)li.light-wrapper(class="light-wrapper-" + x).stabilise: .lightul.spiral.five- for (var x = 1; x <= 43; x++)li.light-wrapper(class="light-wrapper-" + x).stabilise: .lightul.spiral.six- for (var x = 1; x <= 43; x++)li.light-wrapper(class="light-wrapper-" + x).stabilise: .light.text-container//- h2 The best is yet to comeh2.happy Happy Holidays

LESS代码:

@import url('https://fonts.googleapis.com/css?family=Great+Vibes');
@itemsize: 6px;.main-wrapper {background: radial-gradient(ellipse at bottom, #a90e0e 5%, #4e0303 55%, #330000 78%);position: absolute;display: flex;align-items: center;justify-content: center;top: 0;left: 0;width: 100%;height: 100%;margin: 0;padding: 0;
}.tree-container {display: block;	height: 370px;margin: 0;padding: 0;
}.text-container {margin: 0;padding: 0;position: absolute;bottom: 14%;left: 15%;right: 15%;display: flex;align-items: center;justify-content: center;flex-direction: column;text-align: center;h2 {color: rgba(252, 251, 233, 0.85);font-family: 'Great Vibes', cursive;font-weight: 400;margin: 0 0 .8em 0;&.happy {font-size: 3.3em;}}a.c2 {@size: 40px;display: block;font-size: 13px;width: @size;height: @size;background-color: rgba(252, 251, 233, 0.8);border-radius: 50%;color: #8c1313;text-decoration: none;line-height: @size;}
}.star {@dimensions: 12px;@color: #f7b93f;@divider: 1.3;border-radius: 0;border-color: @color transparent transparent transparent;border-style: solid;border-top-width: @dimensions / @divider;border-right-width: @dimensions;border-left-width: @dimensions;height: 0;width: 0;margin-bottom: 5px;background: transparent;z-index: 100;animation: pulsate-star 1.4s ease-in-out infinite alternate-reverse;&:before,&:after {border-color: @color transparent transparent transparent;border-style: solid;border-top-width: @dimensions / @divider;border-right-width: @dimensions;border-left-width: @dimensions;border-bottom: 0;content: '';display: block;height: 0;left: -@dimensions;position: absolute;top: -@dimensions / @divider;width: 0;}&:before {transform: translate(15.5555555%, -15.5555555%) rotate(360deg/5) translateY(50%);}&:after {transform: translate(-15.5555555%, -15.5555555%) rotate(-360deg/5) translateY(50%);}
}.spiral-container {width: 100%;height: 100%;display: block;
}.spiral {position: relative;margin: 0;padding: 0;transform-style: preserve-3d;&.one {animation: rotate-tree 6s infinite linear both;animation-delay: 0s;.light {background: #fcfbe9;}}&.two {animation: rotate-tree 7s infinite linear both;animation-delay: 0.5s;.light {background: #e8a41d;}}&.three {animation: rotate-tree 8s infinite linear both;animation-delay: 1s;.light {background: #f5e393;}}&.four {animation: rotate-tree 9s infinite linear both;animation-delay: 1.5s;.light {background: #a1e8a4;}}&.five {animation: rotate-tree 10s infinite linear both;animation-delay: 2s;.light {background: #e8a4d8;}}&.six {animation: rotate-tree 11s infinite linear both;animation-delay: 2.5s;.light {background: #a4d8e8;}}> .light-wrapper {border-radius: 50%;position: absolute;display: block;width: @itemsize;height: @itemsize;left: 50%;top: 50%;margin: -@itemsize/2 0 0 -@itemsize/2;}.stabilise {position: absolute;display: block;width: 100%;height: 100%;}.light {position: absolute;display: block;width: 100%;height: 100%;border-radius: 50%;top: 0;left: 0;border-radius: 50%;opacity: 1;animation-name: pulsate;animation-timing-function: ease-in-out;animation-iteration-count: infinite;animation-direction: alternate-reverse;}
}.makespiral( @className: ~".spiral"; @itemNo:3; @degrees:0; @elNo: 1; @size: 5px; @delayOffset: 0 ) when ( @elNo <= @itemNo ) {@spacing: 11;@currDeg: unit(@degrees,deg);@correctionDeg: unit(-@degrees,deg);@y: unit(cos(@currDeg) * @elNo * @elNo / 10, px);@x: unit(sin(@currDeg) * @elNo * @elNo / 10, px);@z: unit(@elNo * @elNo / 6, px);@duration: 0.65s; // 固定持续时间@{className} {.light-wrapper.light-wrapper-@{elNo} {transform: translate3d( @x, @y, @z ) rotateX(90deg) rotateZ(0deg) rotateY(@correctionDeg);width: (@size * (@elNo / @itemNo) * 7);height: (@size * (@elNo / @itemNo) * 7);.light {animation-duration: @duration;animation-delay: @delayOffset + @elNo * 0.1s;}}}.makespiral(@className; @itemNo; @degrees + @spacing; @elNo + 1; @size; @delayOffset);
}.makespiral(@className: ~".spiral.one"; @itemNo: 43; @size: 2px); // 第一条螺旋
.makespiral(@className: ~".spiral.two"; @itemNo: 43; @size: 3px; @delayOffset: 1); // 第二条螺旋
.makespiral(@className: ~".spiral.three"; @itemNo: 43; @size: 2px; @delayOffset: .5); // 第三条螺旋
.makespiral(@className: ~".spiral.four"; @itemNo: 43; @size: 2.5px; @delayOffset: 0.8); // 第四条螺旋
.makespiral(@className: ~".spiral.five"; @itemNo: 43; @size: 3.5px; @delayOffset: 0.3); // 第五条螺旋
.makespiral(@className: ~".spiral.six"; @itemNo: 43; @size: 2.8px; @delayOffset: 1.2); // 第六条螺旋@keyframes pulsate {0% {transform: scale(.5);opacity: .4;}100% {transform: scale(1);}
}@keyframes pulsate-star {0% {transform: scale(.9);opacity: .8;}100% {transform: scale(1);opacity: 1;}
}@keyframes rotate-tree {0% {transform: rotateX(-90deg) rotateZ(0deg) rotateY(0deg);}100% {transform: rotateX(-90deg) rotateZ(360deg) rotateY(0deg);}
}

源码地址(因为源码会报错,上面的代码是修改过能运行的,而且在效果上我也做了些改变):Animated 3D Christmas Tree · GitHub

-----------------------------------------------------------------我是分割线--------------------------------------------------------------

看完了觉得不错就点个赞或者评论下吧,感谢!!!

这篇关于HTML圣诞树代码(动态效果)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/516541

相关文章

Vue3 的 shallowRef 和 shallowReactive:优化性能

大家对 Vue3 的 ref 和 reactive 都很熟悉,那么对 shallowRef 和 shallowReactive 是否了解呢? 在编程和数据结构中,“shallow”(浅层)通常指对数据结构的最外层进行操作,而不递归地处理其内部或嵌套的数据。这种处理方式关注的是数据结构的第一层属性或元素,而忽略更深层次的嵌套内容。 1. 浅层与深层的对比 1.1 浅层(Shallow) 定义

这15个Vue指令,让你的项目开发爽到爆

1. V-Hotkey 仓库地址: github.com/Dafrok/v-ho… Demo: 戳这里 https://dafrok.github.io/v-hotkey 安装: npm install --save v-hotkey 这个指令可以给组件绑定一个或多个快捷键。你想要通过按下 Escape 键后隐藏某个组件,按住 Control 和回车键再显示它吗?小菜一碟: <template

【 html+css 绚丽Loading 】000046 三才归元阵

前言:哈喽,大家好,今天给大家分享html+css 绚丽Loading!并提供具体代码帮助大家深入理解,彻底掌握!创作不易,如果能帮助到大家或者给大家一些灵感和启发,欢迎收藏+关注哦 💕 目录 📚一、效果📚二、信息💡1.简介:💡2.外观描述:💡3.使用方式:💡4.战斗方式:💡5.提升:💡6.传说: 📚三、源代码,上代码,可以直接复制使用🎥效果🗂️目录✍️

【前端学习】AntV G6-08 深入图形与图形分组、自定义节点、节点动画(下)

【课程链接】 AntV G6:深入图形与图形分组、自定义节点、节点动画(下)_哔哩哔哩_bilibili 本章十吾老师讲解了一个复杂的自定义节点中,应该怎样去计算和绘制图形,如何给一个图形制作不间断的动画,以及在鼠标事件之后产生动画。(有点难,需要好好理解) <!DOCTYPE html><html><head><meta charset="UTF-8"><title>06

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来

poj 1258 Agri-Net(最小生成树模板代码)

感觉用这题来当模板更适合。 题意就是给你邻接矩阵求最小生成树啦。~ prim代码:效率很高。172k...0ms。 #include<stdio.h>#include<algorithm>using namespace std;const int MaxN = 101;const int INF = 0x3f3f3f3f;int g[MaxN][MaxN];int n

计算机毕业设计 大学志愿填报系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试

🍊作者:计算机编程-吉哥 🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点赞 👍 收藏 ⭐评论 📝 🍅 文末获取源码联系 👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~Java毕业设计项目~热门选题推荐《1000套》 目录 1.技术选型 2.开发工具 3.功能

Vue3项目开发——新闻发布管理系统(六)

文章目录 八、首页设计开发1、页面设计2、登录访问拦截实现3、用户基本信息显示①封装用户基本信息获取接口②用户基本信息存储③用户基本信息调用④用户基本信息动态渲染 4、退出功能实现①注册点击事件②添加退出功能③数据清理 5、代码下载 八、首页设计开发 登录成功后,系统就进入了首页。接下来,也就进行首页的开发了。 1、页面设计 系统页面主要分为三部分,左侧为系统的菜单栏,右侧

代码随想录冲冲冲 Day39 动态规划Part7

198. 打家劫舍 dp数组的意义是在第i位的时候偷的最大钱数是多少 如果nums的size为0 总价值当然就是0 如果nums的size为1 总价值是nums[0] 遍历顺序就是从小到大遍历 之后是递推公式 对于dp[i]的最大价值来说有两种可能 1.偷第i个 那么最大价值就是dp[i-2]+nums[i] 2.不偷第i个 那么价值就是dp[i-1] 之后取这两个的最大值就是d

pip-tools:打造可重复、可控的 Python 开发环境,解决依赖关系,让代码更稳定

在 Python 开发中,管理依赖关系是一项繁琐且容易出错的任务。手动更新依赖版本、处理冲突、确保一致性等等,都可能让开发者感到头疼。而 pip-tools 为开发者提供了一套稳定可靠的解决方案。 什么是 pip-tools? pip-tools 是一组命令行工具,旨在简化 Python 依赖关系的管理,确保项目环境的稳定性和可重复性。它主要包含两个核心工具:pip-compile 和 pip