Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
草原上有什么
漂亮的时钟
提交
b3880e8b
漂
漂亮的时钟
项目概览
草原上有什么
/
漂亮的时钟
与 Fork 源项目一致
Fork自
inscode / HTML-CSS-JS
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
漂
漂亮的时钟
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b3880e8b
编写于
11月 15, 2023
作者:
W
weixin_40885370
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Auto Commit
上级
ef53fd87
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
174 addition
and
16 deletion
+174
-16
.inscode
.inscode
+5
-1
index.html
index.html
+87
-14
style.css
style.css
+82
-1
未找到文件。
.inscode
浏览文件 @
b3880e8b
run = "index.html"
language = "node"
[env]
PATH = "/root/${PROJECT_DIR}/.config/npm/node_global/bin:/root/${PROJECT_DIR}/node_modules/.bin:${PATH}"
XDG_CONFIG_HOME = "/root/.config"
npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global"
\ No newline at end of file
npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global"
[debugger]
program = "main.js"
index.html
浏览文件 @
b3880e8b
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
href=
"style.css"
rel=
"stylesheet"
type=
"text/css"
/>
<title>
InsCode
</title>
</head>
<body>
<div
class=
"container"
>
<img
src=
"src/assets/logo.svg"
alt=
"InsCode"
>
<div>
欢迎来到 InsCode
</div>
<head>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, inital-scale=1.0"
/>
<link
rel=
"stylesheet"
href=
"style.css"
/>
<title>
CSS
</title>
</head>
<body>
<div
id=
"time"
>
<div
class=
"circle"
style=
"--clr: #ff2972"
>
<div
class=
"dots hr_dot"
></div>
<svg>
<circle
cx=
"70"
cy=
"70"
r=
"70"
></circle>
<circle
cx=
"70"
cy=
"70"
r=
"70"
id=
"hh"
></circle>
</svg>
<div
id=
"hours"
>
00
</div>
</div>
<div
class=
"circle"
style=
"--clr: #fee800"
>
<div
class=
"dots min_dot"
></div>
<svg>
<circle
cx=
"70"
cy=
"70"
r=
"70"
></circle>
<circle
cx=
"70"
cy=
"70"
r=
"70"
id=
"mm"
></circle>
</svg>
<div
id=
"minutes"
>
00
</div>
</div>
<div
class=
"circle"
style=
"--clr: #04fc43"
>
<div
class=
"dots sec_dot"
></div>
<svg>
<circle
cx=
"70"
cy=
"70"
r=
"70"
></circle>
<circle
cx=
"70"
cy=
"70"
r=
"70"
id=
"ss"
></circle>
</svg>
<div
id=
"seconds"
>
00
</div>
</div>
<div
class=
"ap"
>
<div
id=
"ampm"
>
AM
</div>
</div>
</div>
<script
src=
"script.js"
></script>
</body>
</html>
\ No newline at end of file
<script>
setInterval
(()
=>
{
let
hours
=
document
.
getElementById
(
"
hours
"
);
let
minutes
=
document
.
getElementById
(
"
minutes
"
);
let
seconds
=
document
.
getElementById
(
"
seconds
"
);
let
ampm
=
document
.
getElementById
(
"
ampm
"
);
let
hh
=
document
.
getElementById
(
"
hh
"
);
let
mm
=
document
.
getElementById
(
"
mm
"
);
let
ss
=
document
.
getElementById
(
"
ss
"
);
let
hr_dot
=
document
.
querySelector
(
"
.hr_dot
"
);
let
min_dot
=
document
.
querySelector
(
"
.min_dot
"
);
let
sec_dot
=
document
.
querySelector
(
"
.sec_dot
"
);
let
h
=
new
Date
().
getHours
();
let
m
=
new
Date
().
getMinutes
();
let
s
=
new
Date
().
getSeconds
();
let
am
=
h
>=
12
?
"
PM
"
:
"
AM
"
;
//12小时制
if
(
h
>
12
)
{
h
=
h
-
12
;
}
h
=
h
<
10
?
"
0
"
+
h
:
h
;
m
=
m
<
10
?
"
0
"
+
m
:
m
;
s
=
s
<
10
?
"
0
"
+
s
:
s
;
hours
.
innerHTML
=
h
+
"
<br><span>Hours</span>
"
;
minutes
.
innerHTML
=
m
+
"
<br><span>Minutes</span>
"
;
seconds
.
innerHTML
=
s
+
"
<br><span>Seconds</span>
"
;
ampm
.
innerHTML
=
am
;
//12h
hh
.
style
.
strokeDashoffset
=
440
-
(
440
*
h
)
/
12
;
//60m
mm
.
style
.
strokeDashoffset
=
440
-
(
440
*
m
)
/
60
;
//60s
ss
.
style
.
strokeDashoffset
=
440
-
(
440
*
s
)
/
60
;
//360 / 12 = 30
hr_dot
.
style
.
transform
=
`rotate(
${
h
*
30
}
deg)`
;
//360 / 60 = 6
min_dot
.
style
.
transform
=
`rotate(
${
m
*
6
}
deg)`
;
//360 / 60 = 6
sec_dot
.
style
.
transform
=
`rotate(
${
s
*
6
}
deg)`
;
});
</script>
</body>
</html>
style.css
浏览文件 @
b3880e8b
...
...
@@ -6,4 +6,85 @@ html{
.container
{
text-align
:
center
;
padding
:
64px
;
}
\ No newline at end of file
}
*
{
margin
:
0
;
padding
:
0
;
box-sizing
:
border-box
;
font-family
:
"Poppins"
,
sans-serif
;
}
body
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
min-height
:
100vh
;
background
:
#2f363e
;
}
#time
{
display
:
flex
;
gap
:
40px
;
color
:
#fff
;
}
#time
.circle
{
position
:
relative
;
width
:
150px
;
height
:
150px
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
#time
.circle
svg
{
position
:
relative
;
width
:
150px
;
height
:
150px
;
transform
:
rotate
(
270deg
);
}
#time
.circle
svg
circle
{
width
:
100%
;
height
:
100%
;
fill
:
transparent
;
stroke
:
#191919
;
stroke-width
:
4
;
transform
:
translate
(
5px
,
5px
);
}
#time
.circle
svg
circle
:nth-child
(
2
)
{
stroke
:
var
(
--clr
);
stroke-dasharray
:
440
;
}
#time
div
{
position
:
absolute
;
text-align
:
center
;
font-weight
:
500
;
font-size
:
1.5em
;
}
#time
div
span
{
position
:
absolute
;
transform
:
translateX
(
-50%
)
translateY
(
-10px
);
font-size
:
0.35em
;
font-weight
:
300
;
letter-spacing
:
0.1em
;
text-transform
:
uppercase
;
}
#time
.ap
{
position
:
relative
;
font-size
:
1em
;
transform
:
translateX
(
-20px
);
}
.dots
{
position
:
absolute
;
width
:
100%
;
height
:
100%
;
z-index
:
10
;
display
:
flex
;
justify-content
:
center
;
}
.dots
::before
{
content
:
" "
;
position
:
absolute
;
top
:
-3px
;
width
:
15px
;
height
:
15px
;
background
:
var
(
--clr
);
border-radius
:
50%
;
box-shadow
:
0
0
20px
var
(
--clr
),
0
0
60px
var
(
--clr
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录