当前位置: 首页 > 编程日记 > 正文

canvas烟花锦集

canvas可以实现不同动画效果,本文主要记录几种不同节日烟花效果实现。

原文链接

实现一

firework

效果地址

html

<canvas id="canvas"></canvas>

css

body {background: #000;margin: 0;
}canvas {cursor: crosshair;display: block;
}

js

// when animating on canvas, it is best to use requestAnimationFrame instead of setTimeout or setInterval
// not supported in all browsers though and sometimes needs a prefix, so we need a shim
window.requestAnimFrame = (function () {return window.requestAnimationFrame ||window.webkitRequestAnimationFrame ||window.mozRequestAnimationFrame ||function (callback) {window.setTimeout(callback, 1000 / 60);};
})();// now we will setup our basic variables for the demo
var canvas = document.getElementById('canvas'),ctx = canvas.getContext('2d'),// full screen dimensionscw = window.innerWidth,ch = window.innerHeight,// firework collectionfireworks = [],// particle collectionparticles = [],// starting huehue = 120,// when launching fireworks with a click, too many get launched at once without a limiter, one launch per 5 loop tickslimiterTotal = 5,limiterTick = 0,// this will time the auto launches of fireworks, one launch per 80 loop tickstimerTotal = 80,timerTick = 0,mousedown = false,// mouse x coordinate,mx,// mouse y coordinatemy;// set canvas dimensions
canvas.width = cw;
canvas.height = ch;// now we are going to setup our function placeholders for the entire demo// get a random number within a range
function random(min, max) {return Math.random() * (max - min) + min;
}// calculate the distance between two points
function calculateDistance(p1x, p1y, p2x, p2y) {var xDistance = p1x - p2x,yDistance = p1y - p2y;return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2));
}// create firework
function Firework(sx, sy, tx, ty) {// actual coordinatesthis.x = sx;this.y = sy;// starting coordinatesthis.sx = sx;this.sy = sy;// target coordinatesthis.tx = tx;this.ty = ty;// distance from starting point to targetthis.distanceToTarget = calculateDistance(sx, sy, tx, ty);this.distanceTraveled = 0;// track the past coordinates of each firework to create a trail effect, increase the coordinate count to create more prominent trailsthis.coordinates = [];this.coordinateCount = 3;// populate initial coordinate collection with the current coordinateswhile (this.coordinateCount--) {this.coordinates.push([this.x, this.y]);}this.angle = Math.atan2(ty - sy, tx - sx);this.speed = 2;this.acceleration = 1.05;this.brightness = random(50, 70);// circle target indicator radiusthis.targetRadius = 1;
}// update firework
Firework.prototype.update = function (index) {// remove last item in coordinates arraythis.coordinates.pop();// add current coordinates to the start of the arraythis.coordinates.unshift([this.x, this.y]);// cycle the circle target indicator radiusif (this.targetRadius < 8) {this.targetRadius += 0.3;} else {this.targetRadius = 1;}// speed up the fireworkthis.speed *= this.acceleration;// get the current velocities based on angle and speedvar vx = Math.cos(this.angle) * this.speed,vy = Math.sin(this.angle) * this.speed;// how far will the firework have traveled with velocities applied?this.distanceTraveled = calculateDistance(this.sx, this.sy, this.x + vx, this.y + vy);// if the distance traveled, including velocities, is greater than the initial distance to the target, then the target has been reachedif (this.distanceTraveled >= this.distanceToTarget) {createParticles(this.tx, this.ty);// remove the firework, use the index passed into the update function to determine which to removefireworks.splice(index, 1);} else {// target not reached, keep travelingthis.x += vx;this.y += vy;}
}// draw firework
Firework.prototype.draw = function () {ctx.beginPath();// move to the last tracked coordinate in the set, then draw a line to the current x and yctx.moveTo(this.coordinates[this.coordinates.length - 1][0], this.coordinates[this.coordinates.length - 1][1]);ctx.lineTo(this.x, this.y);ctx.strokeStyle = 'hsl(' + hue + ', 100%, ' + this.brightness + '%)';ctx.stroke();ctx.beginPath();// draw the target for this firework with a pulsing circlectx.arc(this.tx, this.ty, this.targetRadius, 0, Math.PI * 2);ctx.stroke();
}// create particle
function Particle(x, y) {this.x = x;this.y = y;// track the past coordinates of each particle to create a trail effect, increase the coordinate count to create more prominent trailsthis.coordinates = [];this.coordinateCount = 5;while (this.coordinateCount--) {this.coordinates.push([this.x, this.y]);}// set a random angle in all possible directions, in radiansthis.angle = random(0, Math.PI * 2);this.speed = random(1, 10);// friction will slow the particle downthis.friction = 0.95;// gravity will be applied and pull the particle downthis.gravity = 1;// set the hue to a random number +-20 of the overall hue variablethis.hue = random(hue - 20, hue + 20);this.brightness = random(50, 80);this.alpha = 1;// set how fast the particle fades outthis.decay = random(0.015, 0.03);
}// update particle
Particle.prototype.update = function (index) {// remove last item in coordinates arraythis.coordinates.pop();// add current coordinates to the start of the arraythis.coordinates.unshift([this.x, this.y]);// slow down the particlethis.speed *= this.friction;// apply velocitythis.x += Math.cos(this.angle) * this.speed;this.y += Math.sin(this.angle) * this.speed + this.gravity;// fade out the particlethis.alpha -= this.decay;// remove the particle once the alpha is low enough, based on the passed in indexif (this.alpha <= this.decay) {particles.splice(index, 1);}
}// draw particle
Particle.prototype.draw = function () {ctx.beginPath();// move to the last tracked coordinates in the set, then draw a line to the current x and yctx.moveTo(this.coordinates[this.coordinates.length - 1][0], this.coordinates[this.coordinates.length - 1][1]);ctx.lineTo(this.x, this.y);ctx.strokeStyle = 'hsla(' + this.hue + ', 100%, ' + this.brightness + '%, ' + this.alpha + ')';ctx.stroke();}// create particle group/explosion
function createParticles(x, y) {// increase the particle count for a bigger explosion, beware of the canvas performance hit with the increased particles thoughvar particleCount = 30;while (particleCount--) {particles.push(new Particle(x, y));}
}// main demo loop
function loop() {// this function will run endlessly with requestAnimationFramerequestAnimFrame(loop);// increase the hue to get different colored fireworks over timehue += 0.5;// normally, clearRect() would be used to clear the canvas// we want to create a trailing effect though// setting the composite operation to destination-out will allow us to clear the canvas at a specific opacity, rather than wiping it entirelyctx.globalCompositeOperation = 'destination-out';// decrease the alpha property to create more prominent trailsctx.fillStyle = 'rgba(0, 0, 0, 0.5)';ctx.fillRect(0, 0, cw, ch);// change the composite operation back to our main mode// lighter creates bright highlight points as the fireworks and particles overlap each otherctx.globalCompositeOperation = 'lighter';var text = "HAPPY NEW YEAR !";ctx.font = "50px sans-serif";var textData = ctx.measureText(text);ctx.fillStyle = "rgba(" + parseInt(random(0, 255)) + "," + parseInt(random(0, 255)) + "," + parseInt(random(0,255)) + ",0.3)";ctx.fillText(text, cw / 2 - textData.width / 2, ch / 2);// loop over each firework, draw it, update itvar i = fireworks.length;while (i--) {fireworks[i].draw();fireworks[i].update(i);}// loop over each particle, draw it, update itvar i = particles.length;while (i--) {particles[i].draw();particles[i].update(i);}// launch fireworks automatically to random coordinates, when the mouse isn't downif (timerTick >= timerTotal) {if (!mousedown) {// start the firework at the bottom middle of the screen, then set the random target coordinates, the random y coordinates will be set within the range of the top half of the screenfor (var h = 0; h < 50; h++) {fireworks.push(new Firework(cw / 2, ch / 2, random(0, cw), random(0, ch)));}timerTick = 0;}} else {timerTick++;}// limit the rate at which fireworks get launched when mouse is downif (limiterTick >= limiterTotal) {if (mousedown) {// start the firework at the bottom middle of the screen, then set the current mouse coordinates as the targetfireworks.push(new Firework(cw / 2, ch / 2, mx, my));limiterTick = 0;}} else {limiterTick++;}
}// mouse event bindings
// update the mouse coordinates on mousemove
canvas.addEventListener('mousemove', function (e) {mx = e.pageX - canvas.offsetLeft;my = e.pageY - canvas.offsetTop;
});// toggle mousedown state and prevent canvas from being selected
canvas.addEventListener('mousedown', function (e) {e.preventDefault();mousedown = true;
});canvas.addEventListener('mouseup', function (e) {e.preventDefault();mousedown = false;
});// once the window loads, we are ready for some fireworks!
window.onload = loop;

实现二

firework
效果地址

html

<canvas></canvas>
<h1>201<span>8</span></h1>

css

html,
body {padding: 0px;margin: 0px;background: #222;font-family: 'Karla', sans-serif;color: #FFF;height: 100%;overflow: hidden;
}h1 {z-index: 1000;position: fixed;top: 50%;left: 50%;transform: translateX(-50%) translateY(-100%);font-size: 58px;overflow: hidden;
}span {position: relative;display: inline-block;animation: drop 0.75s ease 0s;
}canvas {width: 100%;height: 100%;
}@keyframes drop {0% {transform: translateY(-100px);opacity: 0;}90% {opacity: 1;transform: translateY(10px);}100% {transform: translateY(0px);}
}

js

var ctx = document.querySelector('canvas').getContext('2d')
ctx.canvas.width = window.innerWidth
ctx.canvas.height = window.innerHeightvar sparks = []
var fireworks = []
var i = 20;
while (i--) {fireworks.push(new Firework(Math.random() * window.innerWidth, window.innerHeight * Math.random()))
}render()function render() {setTimeout(render, 1000 / 60)ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height)for (var firework of fireworks) {if (firework.dead) continuefirework.move()firework.draw()}for (var spark of sparks) {if (spark.dead) continuespark.move()spark.draw()}if (Math.random() < 0.05) {fireworks.push(new Firework())}
}function Spark(x, y, color) {this.x = xthis.y = ythis.dir = Math.random() * (Math.PI * 2)this.dead = falsethis.color = colorthis.speed = Math.random() * 3 + 3;this.walker = new Walker({radius: 20,speed: 0.25})this.gravity = 0.25this.dur = this.speed / 0.1this.move = function () {this.dur--if (this.dur < 0) this.dead = trueif (this.speed < 0) returnif (this.speed > 0) this.speed -= 0.1var walk = this.walker.step()this.x += Math.cos(this.dir + walk) * this.speedthis.y += Math.sin(this.dir + walk) * this.speedthis.y += this.gravitythis.gravity += 0.05}this.draw = function () {drawCircle(this.x, this.y, 3, this.color)}
}function Firework(x, y) {this.xmove = new Walker({radius: 10,speed: 0.5})this.x = x || Math.random() * ctx.canvas.widththis.y = y || ctx.canvas.heightthis.height = Math.random() * ctx.canvas.height / 2this.dead = falsethis.color = randomColor()this.move = function () {this.x += this.xmove.step()if (this.y > this.height) this.y -= 1;else this.burst()}this.draw = function () {drawCircle(this.x, this.y, 1, this.color)}this.burst = function () {this.dead = truevar i = 100;while (i--) sparks.push(new Spark(this.x, this.y, this.color))}
}function drawCircle(x, y, radius, color) {color = color || '#FFF'ctx.fillStyle = colorctx.fillRect(x - radius / 2, y - radius / 2, radius, radius)
}function randomColor() {return ['#6ae5ab', '#88e3b2', '#36b89b', '#7bd7ec', '#66cbe1'][Math.floor(Math.random() * 5)];
}function Walker(options) {this.step = function () {this.direction = Math.sign(this.target) * this.speedthis.value += this.directionthis.target ?this.target -= this.direction :(this.value) ?(this.wander) ?this.target = this.newTarget() :this.target = -this.value :this.target = this.newTarget()return this.direction}this.newTarget = function () {return Math.round(Math.random() * (this.radius * 2) - this.radius)}this.start = 0this.value = 0this.radius = options.radiusthis.target = this.newTarget()this.direction = Math.sign(this.target)this.wander = options.wanderthis.speed = options.speed || 1
}

实现三

firework
效果地址

html

<canvas id="cas" style="background-color:rgba(0,5,24,1)" width="1235" height="680">浏览器不支持canvas</canvas><div class="city"><img src="city.png" alt="">
</div>
<img src="moon.png" alt="" id="moon" style="visibility: hidden;">
<div style="display:none"><div class="shape">新年快乐</div><div class="shape">阖家欢乐</div><div class="shape">万事如意</div><div class="shape">心想事成</div>
</div>

css

body {margin: 0;padding: 0;overflow: hidden;
}.city {width: 100%;position: fixed;bottom: 0px;z-index: 100;
}.city img {width: 100%;
}    

js

var canvas = document.getElementById("cas");
var ocas = document.createElement("canvas");
var octx = ocas.getContext("2d");
var ctx = canvas.getContext("2d");
ocas.width = canvas.width = window.innerWidth;
ocas.height = canvas.height = window.innerHeight;
var bigbooms = [];window.onload = function () {initAnimate()
}function initAnimate() {drawBg();lastTime = new Date();animate();
}var lastTime;function animate() {ctx.save();ctx.fillStyle = "rgba(0,5,24,0.1)";ctx.fillRect(0, 0, canvas.width, canvas.height);ctx.restore();var newTime = new Date();if (newTime - lastTime > 500 + (window.innerHeight - 767) / 2) {var random = Math.random() * 100 > 2 ? true : false;var x = getRandom(canvas.width / 5, canvas.width * 4 / 5);var y = getRandom(50, 200);if (random) {var bigboom = new Boom(getRandom(canvas.width / 3, canvas.width * 2 / 3), 2, "#FFF", {x: x,y: y});bigbooms.push(bigboom)} else {var bigboom = new Boom(getRandom(canvas.width / 3, canvas.width * 2 / 3), 2, "#FFF", {x: canvas.width / 2,y: 200}, document.querySelectorAll(".shape")[parseInt(getRandom(0, document.querySelectorAll(".shape").length))]);bigbooms.push(bigboom)}lastTime = newTime;}stars.foreach(function () {this.paint();})drawMoon();bigbooms.foreach(function (index) {var that = this;if (!this.dead) {this._move();this._drawLight();} else {this.booms.foreach(function (index) {if (!this.dead) {this.moveTo(index);} else if (index === that.booms.length - 1) {bigbooms[bigbooms.indexOf(that)] = null;}})}});raf(animate);
}function drawMoon() {var moon = document.getElementById("moon");var centerX = canvas.width - 200,centerY = 100,width = 80;if (moon.complete) {ctx.drawImage(moon, centerX, centerY, width, width)} else {moon.onload = function () {ctx.drawImage(moon, centerX, centerY, width, width)}}var index = 0;for (var i = 0; i < 10; i++) {ctx.save();ctx.beginPath();ctx.arc(centerX + width / 2, centerY + width / 2, width / 2 + index, 0, 2 * Math.PI);ctx.fillStyle = "rgba(240,219,120,0.005)";index += 2;ctx.fill();ctx.restore();}}Array.prototype.foreach = function (callback) {for (var i = 0; i < this.length; i++) {if (this[i] !== null) callback.apply(this[i], [i])}
}var raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame ||window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) {window.setTimeout(callback, 1000 / 60);};canvas.onclick = function () {var x = event.clientX;var y = event.clientY;var bigboom = new Boom(getRandom(canvas.width / 3, canvas.width * 2 / 3), 2, "#FFF", {x: x,y: y});bigbooms.push(bigboom)
}var Boom = function (x, r, c, boomArea, shape) {this.booms = [];this.x = x;this.y = (canvas.height + r);this.r = r;this.c = c;this.shape = shape || false;this.boomArea = boomArea;this.theta = 0;this.dead = false;this.ba = parseInt(getRandom(80, 200));
}
Boom.prototype = {_paint: function () {ctx.save();ctx.beginPath();ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI);ctx.fillStyle = this.c;ctx.fill();ctx.restore();},_move: function () {var dx = this.boomArea.x - this.x,dy = this.boomArea.y - this.y;this.x = this.x + dx * 0.01;this.y = this.y + dy * 0.01;if (Math.abs(dx) <= this.ba && Math.abs(dy) <= this.ba) {if (this.shape) {this._shapBoom();} else this._boom();this.dead = true;} else {this._paint();}},_drawLight: function () {ctx.save();ctx.fillStyle = "rgba(255,228,150,0.3)";ctx.beginPath();ctx.arc(this.x, this.y, this.r + 3 * Math.random() + 1, 0, 2 * Math.PI);ctx.fill();ctx.restore();},_boom: function () {var fragNum = getRandom(30, 200);var style = getRandom(0, 10) >= 5 ? 1 : 2;var color;if (style === 1) {color = {a: parseInt(getRandom(128, 255)),b: parseInt(getRandom(128, 255)),c: parseInt(getRandom(128, 255))}}var fanwei = parseInt(getRandom(300, 400));for (var i = 0; i < fragNum; i++) {if (style === 2) {color = {a: parseInt(getRandom(128, 255)),b: parseInt(getRandom(128, 255)),c: parseInt(getRandom(128, 255))}}var a = getRandom(-Math.PI, Math.PI);var x = getRandom(0, fanwei) * Math.cos(a) + this.x;var y = getRandom(0, fanwei) * Math.sin(a) + this.y;var radius = getRandom(0, 2)var frag = new Frag(this.x, this.y, radius, color, x, y);this.booms.push(frag);}},_shapBoom: function () {var that = this;putValue(ocas, octx, this.shape, 5, function (dots) {var dx = canvas.width / 2 - that.x;var dy = canvas.height / 2 - that.y;for (var i = 0; i < dots.length; i++) {color = {a: dots[i].a,b: dots[i].b,c: dots[i].c}var x = dots[i].x;var y = dots[i].y;var radius = 1;var frag = new Frag(that.x, that.y, radius, color, x - dx, y - dy);that.booms.push(frag);}})}
}function putValue(canvas, context, ele, dr, callback) {context.clearRect(0, 0, canvas.width, canvas.height);var img = new Image();if (ele.innerHTML.indexOf("img") >= 0) {img.src = ele.getElementsByTagName("img")[0].src;imgload(img, function () {context.drawImage(img, canvas.width / 2 - img.width / 2, canvas.height / 2 - img.width / 2);dots = getimgData(canvas, context, dr);callback(dots);})} else {var text = ele.innerHTML;context.save();var fontSize = 200;context.font = fontSize + "px 宋体 bold";context.textAlign = "center";context.textBaseline = "middle";context.fillStyle = "rgba(" + parseInt(getRandom(128, 255)) + "," + parseInt(getRandom(128, 255)) + "," +parseInt(getRandom(128, 255)) + " , 1)";context.fillText(text, canvas.width / 2, canvas.height / 2);context.restore();dots = getimgData(canvas, context, dr);callback(dots);}
}function imgload(img, callback) {if (img.complete) {callback.call(img);} else {img.onload = function () {callback.call(this);}}
}function getimgData(canvas, context, dr) {var imgData = context.getImageData(0, 0, canvas.width, canvas.height);context.clearRect(0, 0, canvas.width, canvas.height);var dots = [];for (var x = 0; x < imgData.width; x += dr) {for (var y = 0; y < imgData.height; y += dr) {var i = (y * imgData.width + x) * 4;if (imgData.data[i + 3] > 128) {var dot = {x: x,y: y,a: imgData.data[i],b: imgData.data[i + 1],c: imgData.data[i + 2]};dots.push(dot);}}}return dots;
}function getRandom(a, b) {return Math.random() * (b - a) + a;
}var maxRadius = 1,stars = [];function drawBg() {for (var i = 0; i < 100; i++) {var r = Math.random() * maxRadius;var x = Math.random() * canvas.width;var y = Math.random() * 2 * canvas.height - canvas.height;var star = new Star(x, y, r);stars.push(star);star.paint()}}var Star = function (x, y, r) {this.x = x;this.y = y;this.r = r;
}
Star.prototype = {paint: function () {ctx.save();ctx.beginPath();ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI);ctx.fillStyle = "rgba(255,255,255," + this.r + ")";ctx.fill();ctx.restore();}
}var focallength = 250;
var Frag = function (centerX, centerY, radius, color, tx, ty) {this.tx = tx;this.ty = ty;this.x = centerX;this.y = centerY;this.dead = false;this.centerX = centerX;this.centerY = centerY;this.radius = radius;this.color = color;
}Frag.prototype = {paint: function () {ctx.save();ctx.beginPath();ctx.arc(this.x, this.y, this.radius, 0, 2 * Math.PI);ctx.fillStyle = "rgba(" + this.color.a + "," + this.color.b + "," + this.color.c + ",1)";ctx.fill()ctx.restore();},moveTo: function (index) {this.ty = this.ty + 0.3;var dx = this.tx - this.x,dy = this.ty - this.y;this.x = Math.abs(dx) < 0.1 ? this.tx : (this.x + dx * 0.1);this.y = Math.abs(dy) < 0.1 ? this.ty : (this.y + dy * 0.1);if (dx === 0 && Math.abs(dy) <= 80) {this.dead = true;}this.paint();}
}

总结

几种不同canvas实现烟花动画,基本分为烟火类和碎屑类展现烟花的不同状态。
同时,祝大家新年快乐!

相关文章:

【青少年编程(第29周)】8月份的青少年编程组队学习结营了!

2021年09月05日&#xff08;周日&#xff09;晚20:00我们在青少年编程竞赛交流群开展了第二十九次直播活动。我们直播活动的主要内容如下&#xff1a; 首先&#xff0c;我们奖励了上周测试超过60分的小朋友。 其次&#xff0c;我们一起观看了电子学会等级测试流程的视频。 再…

led伏安特性实验误差分析_检测实验室误差分析知识汇编

2019-12-20 09:56:10 来源: 检测实验室误差分析知识汇编-检测家第一部分 误差理论简介在日常检测工作中&#xff0c;我们虽然有最好的检验方法、有检定合格的仪器设备、有满足检验要求的环境条件和熟悉检验工作的操作人员&#xff0c;但是&#xff0c;得到的检验结果却往往不可…

从Qcheck 1.3 不能在不同操作系统上运行问题(chro124、chro342)说开来------

【本文重在技巧学习&#xff0c;授人以鱼&#xff0c;不如授人以渔&#xff01;&#xff01;&#xff01;】 因为公司项目需要对带宽占用进行测试&#xff0c; 最近看电子工业出版社《网络管理工具使用详解》就qcheck 1.3 不能在不同的操作系统之间运行做一个总结。 本文以标题…

Spark笔试

1.Spark 的四大组件下面哪个不是 (D ) A.Spark Streaming B Mlib C Graphx D Spark R 2.下面哪个端口不是 spark 自带服务的端口 (C ) A.8080 B.4040 C.8090 D.18080 3.spark 1.4 版本的最大变化 (B ) A spark sql Release 版本 B 引入 Spark R C DataFrame D支持动态资源…

秦州:西瓜书 + 南瓜书 吃瓜系列 10. 集成学习(下)

Datawhale南瓜书是经典机器学习教材《机器学习》&#xff08;西瓜书&#xff09;的公式推导解析指南&#xff0c;旨在让在学习西瓜书的过程中&#xff0c;再也没有难推的公式&#xff0c;学好机器学习。 航路开辟者&#xff1a;谢文睿、秦州开源内容&#xff1a;https://githu…

iar定义arm版本_IAR Systems发布 IAR Embedded Workbench for ARM新版本

IAR Systems发布IAR Embedded Workbench for ARM嵌入式开发平台最新版本V5.41。相比于之前的版本&#xff0c;新版本软件在支持Cortex-M0上&#xff0c;将代码大小和执行速度这两个重要性能都提高了13%。本文引用地址&#xff1a;http://www.eepw.com.cn/article/106054.htmNXP…

UVA10110 Light, more light

链接地址。 分析&#xff1a; 如果n能被a整除&#xff0c;那么一定存在一个b使得a*b n。开关经两次变化相当于没有变化。那么只要看a b的那种特殊情况就OK了。 #include <stdio.h> #include <math.h> #include <stdlib.h>int main(){unsigned n, k;while(s…

【组队学习】【29期】Datawhale组队学习内容介绍

第29期 Datawhale 组队学习活动马上就要开始啦&#xff01; 本次组队学习的内容为&#xff1a; 编程实践&#xff08;数据可视化&#xff09;计算机视觉自然语言处理之情感分析吃瓜教程——西瓜书南瓜书李宏毅机器学习&#xff08;含深度学习&#xff09;动手学数据分析集成学…

json的简单的数据格式

json的简单数据格式 var arr{"obj1":["张三","12","女"],"obj2":["李四","12","女"],"obj3":["王五","12","女"],} var str""; $.each(a…

eplise怎么连接数据库_基于手机信令的大数据分析教程(一)数据导入数据库

前言该套教程以一个初学大数据的菜鸟视角&#xff0c;编写数据分析处理的整套流程。写得较为详(luo)细(suo)&#xff0c;希望适用于任何城乡规划大数据的初学者。持续更新中&#xff0c;若有错误&#xff0c;望指正&#xff01;1、任务总纲&#xff08;1&#xff09;职住数据导…

反序列化xml

我是.net 菜鸟。 今天学习一下反序列化xml&#xff0c;即将xml文件转换成程序更好识别的对象。 下面来看一个例子。这是一个xml文件。 <xml> <students> <student> <fields> <field value"name"><field> <field value"i…

【青少年编程】【三级】小鸡吃虫

「青少年编程竞赛交流群」已成立&#xff08;适合6至18周岁的青少年&#xff09;&#xff0c;公众号后台回复【Scratch】或【Python】&#xff0c;即可进入。如果加入了之前的社群不需要重复加入。 微信后台回复“资料下载”可获取以往学习的材料&#xff08;视频、代码、文档&…

Android拍照得到全尺寸图片并进行压缩/拍照或者图库选择 压缩后 图片 上传

http://www.jb51.net/article/77223.htm https://www.cnblogs.com/breeze1988/p/4019510.html

display会影响canvas吗_多动症会影响智商吗?

小智&#xff08;化名&#xff09;小的时候非常皮&#xff0c;上学了也不老实&#xff0c;学习成绩还很差&#xff0c;一直是倒数&#xff0c;还有人说他智商低。父母带他到医院检查&#xff0c;一切都正常&#xff0c;智商也没问题。直到最近他被检查出多动症&#xff0c;小智…

SQL Server 数据库清除日志的方法

方法一&#xff1a; 1、打开查询分析器&#xff0c;输入命令 BACKUP LOG database_name WITH NO_LOG 2、再打开企业管理器--右键要压缩的数据库--所有任务--收缩数据库--收缩文件--选择日志文件--在收缩方式里选择收缩至xxm,这里会给出一个允许收缩到的最小m数,直接输入这个数,…

Axure8.0 网页 or App 鼠标滚动效果

1、index 页下添加一个内联框架&#xff0c;设置好自己想要的尺寸。 2、右键点击该内联框架转换为动态面板&#xff0c;并取消勾选“自动调整为内容尺寸”。 3、双击 “内联框架”选择并双击“state1” 切换到“内联框架的state1”页面&#xff0c;将“内联框架”组件的滚动条设…

【组队学习】【29期】1. 编程实践(数据可视化)

1. 编程实践&#xff08;数据可视化&#xff09; 航路开辟者&#xff1a;杨剑砺、杨煜、耿远昊、李运佳、居凤霞领航员&#xff1a;范佳慧航海士&#xff1a;杨剑砺、伊雪、肖桐、李晴晴、蔡婧旎 基本信息 开源内容&#xff1a;https://github.com/datawhalechina/fantastic…

训练不出结果_智能训练仪:专业化智能防控近视训练设备

视觉训练精准化&#xff0c;近视防控效果佳智能训练仪小百科 智能训练仪是一款近视防控全功能智能康复设备&#xff0c;一机集成十大视功能康复模块&#xff0c;针对各种视功能异常引发的儿童及青少年假…

贪心算法之最优装载

贪心算法通过一系列的选择来得到问题的解。它所做的每一个选择都是当前状态下局部最好选择。从许多的贪心算法求解的问题可以看到可用贪心算法求解的问题一般具有两个重要的性质&#xff1a;贪心选择性质和最优子结构性质。 1、贪心选择性质 贪心选择性质是 指所求问题的整体最…

百度认为什么样的网站更有抓取和收录价值

百度认为什么样的网站更有抓取和收录价值 百度认为什么样的网站更有抓取和收录价值呢?我们从下面几个方面简单介绍.鉴于技术保密以及网站运营的差异等其他原因&#xff0c;以下内容仅供站长参考&#xff0c;具体的收录策略包括但不仅限于所述内容。 第一方面&#xff1a;网站创…

【组队学习】【29期】2. 计算机视觉

2. 计算机视觉 航路开辟者&#xff1a;王程伟、任乔牧、张强、李芝翔领航员&#xff1a;杜蕊航海士&#xff1a;王程伟、任乔牧、张强、李芝翔 基本信息 开源内容&#xff1a;https://github.com/datawhalechina/team-learning-cv/tree/master/ImageProcessingFundamentals内…

python 列表维度_如何输出python中list的维度

python中输出list的维度可以使用numpy来实现:import numpy as np a = [[1,2],[3,4]] print(np.array(a).shape) 扩展: reshape&resize&shape改变数组维度 reshape函数:不改变原数组维度,有返回值 resize函数:直接改变原数组维度,无返回值 shape属性:直接改变原数…

SWFTools PDF转换为SWF

前言 在iText 制作PDF这篇博文中只是简单的介绍了如何制作PDF&#xff0c;为了能让PDF在Web页面中显示&#xff0c;我还需要通过SWFTools工具将PDF文件转换为SWF文件&#xff0c;然后通过SWF文件显示在Web网页中&#xff0c;本次主要是实践SWFTools工具的简单使用&#xff0c;可…

Springboot 中 Mybatis 的使用

2019独角兽企业重金招聘Python工程师标准>>> 官方文档&#xff1a; Mybatis开发团队为Spring Boot 提供了 MyBatis-Spring-Boot-Starter 方便使用。 要使用MyBatis-Spring-Boot-Starter模块&#xff0c;只需要在类路径中包含 mybatis-spring-boot-autoconfigure.ja…

【组队学习】【29期】3. 自然语言处理之情感分析

3. 自然语言处理之情感分析 航路开辟者&#xff1a;芙蕖、戴治旭、陈海顺领航员&#xff1a;初晓宇航海士&#xff1a;芙蕖、戴治旭、陈海顺、汪超 基本信息 开源内容&#xff1a;https://github.com/datawhalechina/team-learning-nlp/tree/master/Emotional_Analysis内容属…

cvpr 深度估计_无监督单目视频深度估计中的uncertainty方法(CVPR#x27;20)

Contribution对11种使用uncertainty方法的全面评估深度挖掘uncertainty对depth estimation起到的作用提出一个新颖的self-teaching方法去model uncertainty文中使用的uncertainty estimation分为两个类别&#xff1a;empirical uncertainty estimation和predictive uncertainty…

python之CSV文件格式

1、csv文件是以一些以逗号分隔的值 import csv filename "wenjian.csv" with open(filename) as f:reader csv.reader()header next(reader)for index,column in enumerate(header):#enumerate函数获取每个元素的索引及其值print(index,column) 转载于:https://ww…

最受欢迎的ASP.NET的CMS下载

http://www.csdn.net/article/2011-11-28/308172 转载于:https://www.cnblogs.com/xuddong/archive/2013/04/08/3071733.html

【组队学习】【29期】4. 吃瓜教程——西瓜书+南瓜书

4. 吃瓜教程——西瓜书南瓜书 航路开辟者&#xff1a;谢文睿、秦州领航员&#xff1a;刘琳航海士&#xff1a;谢文睿、秦州 基本信息 开源内容&#xff1a;https://github.com/datawhalechina/pumpkin-bookB 站视频&#xff1a;https://www.bilibili.com/video/BV1Mh411e7VU…

editor修改样式 vue_vue+element-ui项目搭建实战

1.使用vue ui创建vue工程利用vue-cli提供的图形化工具快速搭建vue工程&#xff1a;命令行运行&#xff1a;vue ui工程结构说明build&#xff1a;项目构建webpack(打包器)相关代码config&#xff1a;配置目录&#xff0c;包括端口号等node_modules&#xff1a;npm加载的项目依赖…