当前位置:网站首页>Realize simple three-D cube automatic rotation
Realize simple three-D cube automatic rotation
2022-06-27 15:54:00 【Fertilizer science】
Table of contents title
demonstration

Technology stack
display:inline-block,block,inline The difference between elements :
display:block Display elements as block level elements , Thus, the width and height of elements can be better controlled , And the inside and outside margins , Each block level element starts with a new line .
display :
inline Display elements as inline elements , Height , Row height and bottom margin cannot be changed , Height is the width of the content text or picture , Can't change . Multiple adjacent inline elements are arranged in the same row , Know that the page can not be arranged in a row , Will change a new line .
display:inline-block Looks like the value name inline-block It's a mixture , Actually it is , Show elements as inline block elements , After setting this property , Other inline block level elements are arranged on the same row . For example, we li Element one inline-block, Make it both block Width height characteristic of , And then there is inline The peer characteristics of , When there are elements with different contents in the same line , Usually you need to set the alignment, such as vertical-align:top; Align the top of the element .
In line labels : Can't set width Height padding margin, The label cannot be automatically extended . Can pass display Flexible conversion of labels within and between lines ;display:inline; Convert to inline labels display:block; Convert to block level labels .
opacity Property to set or return the opacity of the element .
The opacity level of the element describes the transparency level , When opacity is 1 When, it means completely opaque , When opacity is 0.5 Indicates translucency when , When opacity is 0 Is completely transparent .
Source code
css
* {
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
overflow: hidden;
}
canvas {
display: block;
position: absolute;
z-index: -2;
}
.snowback{
height: 100%;
width: 100%;
overflow: hidden;
position: absolute;
z-index: 1;
}
.ziti{
height: 50px;
width: 100%;
font-size: 60px;
text-align: center;
position: absolute;
margin-top: 100px;
z-index: 11;
}
.ziti span {
height: 30px;
width: 100%;
font-size: 25px;
font-family: "å¾è½¯é›…黑";
text-align: center;
line-height: 30px;
/*å…³é”代ç */
background-image: -webkit-linear-gradient(left, rgb(20, 26, 150), #E6D205 25%, rgb(196, 30, 30) 50%, rgb(41, 197, 111) 75%, rgb(175, 23, 221));
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
-webkit-background-size: 200% 100%;
animation: masked-animation 4s infinite linear;
}
/*å…³é”代ç */
@keyframes masked-animation {
0% {
background-position: 0 0;
}
100% {
background-position: -100% 0;
}
}
.main{
width: 200px;
height: 200px;
top:calc(calc(50% - 100px));
margin-left: calc(50% - 100px);
position: absolute;
}
.box {
width: 200px;
height: 200px;
opacity: 1;
position: absolute;
transform: scale(0.8);
}
.box-biger:hover+.box{
transform: scale(0.8);
}
.box-biger{
width: 200px;
height: 200px;
opacity: 0;
transition: all 1s;
position: absolute;
z-index: 10;
}
.box-biger:hover{
width: 600px;
height: 600px;
opacity: 1;
margin-top: calc(50% - 300px);
margin-left: calc(50% - 300px);
}
.box ul {
width: 100%;
height: 100%;
transform-style: preserve-3d;
background-color: transparent;
list-style: none;
position: absolute;
transition: all 1s;
transform-origin: 50% 50% 0;
}
.box-biger ul{
width: 100%;
height: 100%;
transform-style: preserve-3d;
background-color: transparent;
list-style: none;
position: absolute;
transition: all 1s;
}
.small {
font-size: 60px;
text-align: center;
display: inline-block;
width: 100%;
height: 100%;
position: absolute;
box-sizing: border-box;
}
.biger {
font-size: 60px;
text-align: center;
display: inline-block;
width: 100%;
height: 100%;
position: absolute;
box-sizing: border-box;
}
.small img{
height: 100%;
width: 100%;
opacity: 1;
}
.biger img{
height: 70%;
width: 70%;
margin-top: 15%;
margin-left: 15%;
opacity: 0.3;
}
.idv1 {
background-size: cover;
left: 0;
top: 100%;
transform: translateZ(-100px) rotateY(180deg) rotate(180deg);
transform-origin: top;
}
.idv2 {
background-size: cover;
top: 0;
margin-left: 50%;
transform: rotateY(90deg);
}
.idv3 {
background-size: cover;
left: 0;
top: 0;
margin-left: -50%;
transform: rotateY(90deg);
}
.idv4 {
transform: rotateX(90deg);
top: -50%;
}
.idv5 {
transform: rotateX(270deg);
top: 50%;
}
.idv6 {
background-size: cover;
left: 0;
top: 0;
transform: translateZ(100px);
}
.idv7 {
background-size: cover;
left: 0;
top: 100%;
transform: translateZ(-100px) rotateY(180deg) rotate(180deg);
transform-origin: top;
transition: all 1s;
}
.idv12 {
background-size: cover;
left: 0;
top: 0;
transform: translateZ(100px);
transition: all 1s;
}
.box-biger:hover>ul>.idv7{
transform: translateZ(-300px) rotateY(180deg) rotate(180deg);
}
.box-biger:hover>ul>.idv12{
transform: translateZ(300px);
}
.btn {
height: 60px;
text-align: center;
line-height: 60px;
width: 90px;
margin-left: 20px;
float: left;
box-sizing: border-box;
position: absolute;
border-radius: 30px;
z-index: 30;
}
.btn img{
height: 100%;
width: 100%;
}
.btn:hover {
cursor: pointer;
}
.inpbtn {
height: 40px;
float: right;
line-height: 40px;
margin-left: 200px;
background-color: pink;
color: white;
border-radius: 30px;
}
input {
height: 40px;
width: 180px;
float: left;
border-radius: 20px;
font-size: 15px;
}
audio {
height: 40px;
width: 350px;
margin-left: -40px;
margin-top: -1px;
}
.audiobox {
height: 40px;
width: 300px;
border-radius: 20px;
overflow: hidden;
}
.btnonlond:hover>.hiddenbox{
visibility: inherit;
}
.hiddenbox {
margin-top: -60px;
margin-left: 100px;
height: 80px;
width: 300px;
transition: all 2s;
visibility: hidden;
position: absolute;
z-index: 30;
}
js
// Customize these...
var n = 300,
speed = 5,// Speed definition
startSize = rand(100,300);// Size definition
// ...not these
var c = document.getElementById("c"),
ctx = c.getContext("2d"),
cw = (c.width = window.innerWidth),
ch = (c.height = window.innerHeight),
mousePos = {
x:"", y:""},
img = new Image(),
particles = [],
particleNumber = 0,
Particle = function(index) {
this.index = index;
this.dur = (100-rand(9, 90))/speed;
this.draw = function() {
ctx.translate( this.x, this.y );
ctx.globalAlpha = this.alpha;
ctx.globalCompositeOperation = 'lighter';
// if (index%1.5==0) ctx.globalCompositeOperation = 'overlay';
if (index%2==0) ctx.globalCompositeOperation = 'xor';
ctx.drawImage(img, -this.size/2, -this.size/2, this.size, this.size);
ctx.translate( -this.x, -this.y );
}
};
function setParticle(p, firstRun) {
var _x = cw*rand(0,1), _y = ch*rand(0,1), _s = startSize;
if (rand(0,1)>0.3 && mousePos.x!=""){
//console.log(mousePos)
_x = mousePos.x;
_y = mousePos.y;
_s = _s/10;
}
var _tl = new TimelineMax()
.fromTo(p, p.dur, {
x:_x,
y:_y,
size:_s,
alpha:0
},{
size:'+='+String(rand(200,400)),
bezier:[{
alpha:rand(0.15,0.65)},{
alpha:0}],
ease:Power1.easeOut,//ease:Power0.easeNone,
onComplete:function(){
setParticle(p); }
});
if (firstRun) _tl.seek(p.dur*rand()); //fast-forward on first run
}
TweenMax.ticker.addEventListener("tick", function(){
ctx.clearRect(0, 0, cw, ch);
for (var i=0; i<n; i++) particles[i].draw();
});
window.addEventListener('resize', doResize)
function doResize() {
particleNumber = 0;
cw = (c.width = window.innerWidth);
ch = (c.height = window.innerHeight);
for (var i=0; i<n; i++) {
TweenMax.killTweensOf(particles[i]);
setParticle(particles[i], true);
}
TweenMax.fromTo(c, 0.3, {
alpha:0},{
alpha:1, ease:Power3.easeInOut});
}
// First run
for (var i=0; i<n; i++) particles.push(new Particle(i));
doResize();
function rand(min, max) {
(min) ? min=min : min=0;
(max) ? max=max : max=1;
return min + (max-min)*Math.random();
}
Click to get the information directly
If you are learning python perhaps Java Even if it is C If you have any problems, you can leave me a message , Because in the early stage of learning, novices always take many detours , At this time, if there is no one to help, it is easy to give up . There are many such examples around. Many people change their majors and directions as they learn , Not only their own problems, but also the lack of correct learning . So as a passer-by, I hope to leave a message to me if you have any questions , It's not help, it's just a matter of typing a few lines easily .
Here you are python,Java Learning materials and interesting programming projects , More difficult to find resources . Anyway, it's not a loss to see .
边栏推荐
- Design of UART controller based on FPGA (with code)
- 专用发票和普通发票的区别
- 16 -- remove invalid parentheses
- #28对象方法扩展
- 泰山OFFICE技术讲座:第一难点是竖向定位
- LeetCode每日一练(无重复字符的最长子串)
- Design of CAN bus controller based on FPGA (with main codes)
- Principle Comparison and analysis of mechanical hard disk and SSD solid state disk
- Piblup test report 1- pedigree based animal model
- Design of direct spread spectrum communication system based on FPGA (with main code)
猜你喜欢

洛谷入门1【顺序结构】题单题解

2022年最新《谷粒学院开发教程》:8 - 前台登录功能

Eolink launched a support program for small and medium-sized enterprises and start-ups to empower enterprises!
![Beginner level Luogu 2 [branch structure] problem list solution](/img/53/d7bf659f7e1047db4676c9a01fcb42.png)
Beginner level Luogu 2 [branch structure] problem list solution

分布式Session解决方案

A distribution fission activity is more than just a circle of friends!

Introduction to TTCAN brick moving

sql注入原理

express

【Pygame小游戏】这款“吃掉一切”游戏简直奇葩了?通通都吃掉嘛?(附源码免费领)
随机推荐
Design of CAN bus controller based on FPGA (with main codes)
Cesium 使用MediaStreamRecorder 或者MediaRecorder录屏并下载视频,以及开启摄像头录像。【转】
OpenSSF安全计划:SBOM将驱动软件供应链安全
Let's talk about the process of ES Indexing Documents
Scrapy framework (I): basic use
PSS: you are only two convolution layers away from the NMS free+ point | 2021 paper
If you want to use DMS to handle database permissions, can you only use Alibaba cloud ram accounts (Alibaba cloud RDS)
Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing
[MySQL] query valid data based on time
Admixture usage document Cookbook
MySQL中符号@的作用
如果想用dms来处理数据库权限问题,想问下账号只能用阿里云的ram账号吗(阿里云的rds)
ICML 2022 | 阿⾥达摩院最新FEDformer,⻓程时序预测全⾯超越SOTA
洛谷_P1002 [NOIP2002 普及组] 过河卒_dp
我想買固收+產品,但是不了解它主要投資哪些方面,有人知道嗎?
2022年最新《谷粒学院开发教程》:8 - 前台登录功能
[issue 18] share a Netease go classic
PSS:你距离NMS-free+提点只有两个卷积层 | 2021论文
#27ES6的数值扩展
Google Earth Engine(GEE)——Export. image. The difference and mixing of toasset/todrive, correctly export classification sample data to asset assets and references