在我的太阳系模型上,当你单击"切换轨道"时,它会显示所有熟悉的行星地球的轨道,但是你注意到环不在行星中间的中心,只在它的外面,我将如何制作它所以它会在中间吗?
function myFunction() {
for (var i = 0; i < 500; i++) {
var x = Math.random() * screen.width;
var y = Math.random() * screen.height;
var star = document.createElement('div');
star.className = 'star';
star.style.left = x + 'px';
star.style.top = y + 'px';
document.body.appendChild(star);
}
}Run Code Online (Sandbox Code Playgroud)
html {
background-color: #000;
overflow-x: hidden;
overflow-y: hidden;
}
.star {
position: absolute;
width: 1px;
height: 1px;
background: white;
z-index: -1;
}
.sun {
position: absolute;
height: 100px;
width: 100px;
top: 50%;
left: 50%; …Run Code Online (Sandbox Code Playgroud)在我的 Solar System 网站上,每次访问该网站时,我希望在背景上的随机位置上点缀大量闪亮的白色小圆圈(可能有 1 或 2 像素大)。圆圈不必是 scr="" 图像,它可以只是纯白色圆圈。
html {
background-color: #000;
}
.sun {
position: absolute;
height: 100px;
width: 100px;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
border-radius: 50%;
box-shadow: rgb(204, 153, 0) 0px 0px 50px 0px;
}
.earth {
height: 25px;
width: 25px;
border-radius: 50%;
box-shadow: green 0 0 25px;
}
.earth-orbit {
position: absolute;
height: 200px;
width: 200px;
top: 50%;
left: 50%;
margin-left: -100px;
margin-top: -100px;
/*border-radius: 50%;*/
/*border: 1px dotted gray;*/
-webkit-animation: spin-right …Run Code Online (Sandbox Code Playgroud)我想创建一个批处理文件,当运行时,创建一个从0到100的随机整数,然后通过if语句运行它,检查它是奇数还是偶数.我遇到了一些麻烦,所以这就是我到目前为止的情况.
@echo off
set /a num=%random% %%100 +1
if ( num % 2 == 0 ) {
//even
}
else
{
//odd
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是 - "此时意外数字"