2024年最全HTML爱心网页制作[樱花 爱心]_html写一个心形网页,2024年最新最新BAT大厂面试者整理的物联网嵌入式开发面试题目

8,372次阅读
没有评论

共计 4385 个字符,预计需要花费 11 分钟才能阅读完成。

2024 年最全 HTML 爱心网页制作 [樱花 爱心]_html 写一个心形网页,2024 年最新最新 BAT 大厂面试者整理的物联网嵌入式开发面试题目
2024 年最全 HTML 爱心网页制作 [樱花 爱心]_html 写一个心形网页,2024 年最新最新 BAT 大厂面试者整理的物联网嵌入式开发面试题目

既有适合小白学习的零基础资料,也有适合 3 年以上经验的小伙伴深入学习提升的进阶课程,涵盖了 95% 以上物联网嵌入式知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新

如果你需要这些资料,可以戳这里获取

};
Point.prototype.normalize = function () {
var length = this.length();
this.x /= length;
this.y /= length;
return this;
};
return Point;
})();

/*
* Particle class
*/
var Particle = (function () {
function Particle() {
this.position = new Point();
this.velocity = new Point();
this.acceleration = new Point();
this.age = 0;
}
Particle.prototype.initialize = function (x, y, dx, dy) {
this.position.x = x;
this.position.y = y;
this.velocity.x = dx;
this.velocity.y = dy;
this.acceleration.x = dx * settings.particles.effect;
this.acceleration.y = dy * settings.particles.effect;
this.age = 0;
};
Particle.prototype.update = function (deltaTime) {
this.position.x += this.velocity.x * deltaTime;
this.position.y += this.velocity.y * deltaTime;
this.velocity.x += this.acceleration.x * deltaTime;
this.velocity.y += this.acceleration.y * deltaTime;
this.age += deltaTime;
};
Particle.prototype.draw = function (context, image) {
function ease(t) {
return –t * t * t + 1;
}
var size = image.width * ease(this.age / settings.particles.duration);
context.globalAlpha = 1 – this.age / settings.particles.duration;
context.drawImage(
image,
this.position.x – size / 2,
this.position.y – size / 2,
size,
size
);
};
return Particle;
})();

/*
* ParticlePool class
*/
var ParticlePool = (function () {
var particles,
firstActive = 0,
firstFree = 0,
duration = settings.particles.duration;

function ParticlePool(length) {
// create and populate particle pool
particles = new Array(length);
for (var i = 0; i particles[i] = new Particle();
}
ParticlePool.prototype.add = function (x, y, dx, dy) {
particles[firstFree].initialize(x, y, dx, dy);

// handle circular queue
firstFree++;
if (firstFree == particles.length) firstFree = 0;
if (firstActive == firstFree) firstActive++;
if (firstActive == particles.length) firstActive = 0;
};
ParticlePool.prototype.update = function (deltaTime) {
var i;

// update active particles
if (firstActive for (i = firstActive; i particles[i].update(deltaTime);
}
if (firstFree for (i = firstActive; i particles[i].update(deltaTime);
for (i = 0; i}

// remove inactive particles
while (
particles[firstActive].age >= duration &&
firstActive != firstFree
) {
firstActive++;
if (firstActive == particles.length) firstActive = 0;
}
};
ParticlePool.prototype.draw = function (context, image) {
// draw active particles
if (firstActive for (i = firstActive; i particles[i].draw(context, image);
}
if (firstFree for (i = firstActive; i particles[i].draw(context, image);
for (i = 0; i}
};
return ParticlePool;
})();

/*
* Putting it all together
*/
(function (canvas) {
var context = canvas.getContext(“2d”),
particles = new ParticlePool(settings.particles.length),
particleRate =
settings.particles.length / settings.particles.duration, // particles/sec
time;

// get point on heart with -PI function pointOnHeart(t) {
return new Point(
160 * Math.pow(Math.sin(t), 3),
130 * Math.cos(t) –
50 * Math.cos(2 * t) –
20 * Math.cos(3 * t) –
10 * Math.cos(4 * t) +
25
);
}

// creating the particle image using a dummy canvas
var image = (function () {
var canvas = document.createElement(“canvas”),
context = canvas.getContext(“2d”);
canvas.width = settings.particles.size;
canvas.height = settings.particles.size;
// helper function to create the path
function to(t) {
var point = pointOnHeart(t);
point.x =
settings.particles.size / 2 +
(point.x * settings.particles.size) / 350;
point.y =
settings.particles.size / 2 –
(point.y * settings.particles.size) / 350;
return point;
}
// create the path
context.beginPath();
var t = -Math.PI;
var point = to(t);
context.moveTo(point.x, point.y);
while (t t += 0.01; // baby steps!
point = to(t);
context.lineTo(point.x, point.y);
}
context.closePath();
// create the fill
context.fillStyle =“#ea80b0”;
context.fill();
// create the image
var image = new Image();
image.src = canvas.toDataURL();
return image;
})();

// render that thing!
function render() {
// next animation frame
requestAnimationFrame(render);

// update time
var newTime = new Date().getTime() / 1000,
deltaTime = newTime – (time || newTime);
time = newTime;

// clear canvas
context.clearRect(0, 0, canvas.width, canvas.height);

// create new particles
var amount = particleRate * deltaTime;
for (var i = 0; i var pos = pointOnHeart(Math.PI – 2 * Math.PI * Math.random());
var dir = pos.clone().length(settings.particles.velocity);
particles.add(
canvas.width / 2 + pos.x,
canvas.height / 2 – pos.y,
dir.x,
-dir.y
);
}

// update and draw particles
particles.update(deltaTime);
particles.draw(context, image);
}

// handle (re-)sizing of the canvas
function onResize() {
canvas.width = canvas.clientWidth;
canvas.height = canvas.clientHeight;
}
window.onresize = onResize;

// delay rendering bootstrap
setTimeout(function () {
onResize();
render();
}, 10);
})(document.getElementById(“pinkboard”));

原文地址: 2024 年最全 HTML 爱心网页制作 [樱花 爱心]_html 写一个心形网页,2024 年最新最新 BAT 大厂面试者整理的物联网嵌入式开发面试题目

    正文完
     0
    Yojack
    版权声明:本篇文章由 Yojack 于2024-10-30发表,共计4385字。
    转载说明:
    1 本网站名称:优杰开发笔记
    2 本站永久网址:https://yojack.cn
    3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
    4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
    5 本站所有内容均可转载及分享, 但请注明出处
    6 我们始终尊重原创作者的版权,所有文章在发布时,均尽可能注明出处与作者。
    7 站长邮箱:laylwenl@gmail.com
    评论(没有评论)