update
This commit is contained in:
parent
89746e449b
commit
aebb2742dd
33
10000.测试用.html
Normal file
33
10000.测试用.html
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||||
|
<link rel="stylesheet" href="/css/style.css" />
|
||||||
|
<title>测试</title>
|
||||||
|
<script src="/p5/p5.min.js"></script>
|
||||||
|
<script src="/p5/addons/p5.sound.min.js"></script>
|
||||||
|
<script src="/lib/utils.js"></script>
|
||||||
|
<script>
|
||||||
|
let h;
|
||||||
|
function setup() {
|
||||||
|
createCanvas(600, 400);
|
||||||
|
background(200);
|
||||||
|
drawGrid(32);
|
||||||
|
noLoop();
|
||||||
|
h = height;
|
||||||
|
for (let x = 0; x < width; x += 10) {
|
||||||
|
rect(x, height, 10, -h);
|
||||||
|
h = lerp(h, 0, 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function draw() {}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main></main>
|
||||||
|
</body>
|
||||||
|
</html>
|
19
4.柏林噪声.html
19
4.柏林噪声.html
@ -34,6 +34,7 @@
|
|||||||
background(0);
|
background(0);
|
||||||
二维柏林噪声();
|
二维柏林噪声();
|
||||||
一维柏林噪声();
|
一维柏林噪声();
|
||||||
|
textInfo("柏林噪声", "2022/12/12");
|
||||||
}
|
}
|
||||||
|
|
||||||
function 一维柏林噪声() {
|
function 一维柏林噪声() {
|
||||||
@ -42,24 +43,22 @@
|
|||||||
path = path.slice(-width);
|
path = path.slice(-width);
|
||||||
push();
|
push();
|
||||||
strokeWeight(4);
|
strokeWeight(4);
|
||||||
path.forEach((y, i) => {
|
for (let i = 0; i < path.length - 1; i++) {
|
||||||
let h = map(y, 0, height, 0, 255);
|
let h = map(path[i], 0, height, 0, 255);
|
||||||
stroke(h, 255, 255, 1);
|
stroke(h, 255, 255, 1);
|
||||||
fill(h, 255, 255, 1);
|
fill(h, 255, 255, 1);
|
||||||
line(i, y, i + 1, path[i + 1]);
|
line(i, path[i], i + 1, path[i + 1]);
|
||||||
});
|
}
|
||||||
circle(width, y, 8);
|
circle(width, y, 8);
|
||||||
pop();
|
pop();
|
||||||
textInfo("柏林噪声", "2022/12/12");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function 二维柏林噪声() {
|
function 二维柏林噪声() {
|
||||||
noStroke();
|
for (let y = 0; y < height; y += 10) {
|
||||||
for (let j = 0; j < height; j += 10) {
|
for (let x = 0; x < width; x += 10) {
|
||||||
for (let i = 0; i < width; i += 10) {
|
const v = noise(x / 100 + time, y / 100);
|
||||||
const v = noise(i / 100 + time, j / 100);
|
|
||||||
const d = map(v, 0, 1, 0, 10) * 1.5;
|
const d = map(v, 0, 1, 0, 10) * 1.5;
|
||||||
image(粒子贴图, i, j, d, d);
|
image(粒子贴图, x, y, d, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
# Welcome to p5.js
|
|
||||||
|
|
||||||
You have downloaded the complete p5.js library ZIP file, yay!
|
|
||||||
|
|
||||||
# Contents of the p5 folder
|
|
||||||
|
|
||||||
* p5.js file
|
|
||||||
* p5.min.js file
|
|
||||||
* addons folder
|
|
||||||
* p5.sound.js
|
|
||||||
* p5.sound.min.js
|
|
||||||
* empty-example folder
|
|
||||||
* index.html
|
|
||||||
* p5.js
|
|
||||||
* p5.sound.js
|
|
||||||
* sketch.js
|
|
||||||
|
|
||||||
## p5.js
|
|
||||||
|
|
||||||
This file stores the complete p5.js library. It is easy to read by humans, so feel free to open it and explore its contents. It also has a friendly error system, which helps new programmers with common user errors.
|
|
||||||
|
|
||||||
## p5.min.js
|
|
||||||
|
|
||||||
This file is a minified version of the p5.js file. It is a lighter version, with the same functionalities, but smaller file size. This minified version is harder to read for humans, and does not include the friendly error system.
|
|
||||||
|
|
||||||
## addons folder
|
|
||||||
|
|
||||||
The addons folder includes additional p5.js related libraries, in both original versions and minified versions.
|
|
||||||
|
|
||||||
### p5.sound.js, p5.sound.min.js
|
|
||||||
|
|
||||||
p5.sound extends p5.js with Web Audio functionality including audio input, playback, analysis, and synthesis.
|
|
||||||
|
|
||||||
## empty-example folder
|
|
||||||
|
|
||||||
This is an empty example of a website. The folder includes the file for the website, index.html, the p5.js library, other related p5.js libraries, and a template starting point for your p5.js sketch, called sketch.js.
|
|
||||||
|
|
||||||
### index.html
|
|
||||||
|
|
||||||
index.html is a template for an HTML file. This index.html first imports the libraries included in the folder (p5.js, p5.sound.js) then loads and executes the file sketch.js which is where you can write your own code.
|
|
||||||
|
|
||||||
### sketch.js
|
|
||||||
|
|
||||||
The sketch.js is a template for the p5.js sketch, with the functions setup() and draw() that you can complete.
|
|
||||||
|
|
||||||
## README.txt
|
|
||||||
|
|
||||||
This README file formatted with Markdown :)
|
|
||||||
|
|
||||||
# What's next?
|
|
||||||
|
|
||||||
If you need more information to help get you started, please refer to our website:
|
|
||||||
https://p5js.org/get-started/ and https://p5js.org/learn/
|
|
||||||
|
|
||||||
An online reference to the p5.js library is available here:
|
|
||||||
https://p5js.org/reference/
|
|
||||||
|
|
||||||
In order to run your website (including the empty-example), you need to enable a local server, please see this tutorial in our wiki:
|
|
||||||
https://github.com/processing/p5.js/wiki/Local-server
|
|
||||||
|
|
||||||
p5.js is a community and p5.js is built by contributions. If you want to learn more about us, visit:
|
|
||||||
https://p5js.org/community/
|
|
||||||
|
|
||||||
# License
|
|
||||||
|
|
||||||
The p5.js library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1.
|
|
1
p5/addons/p5.sound.js.map
Normal file
1
p5/addons/p5.sound.js.map
Normal file
File diff suppressed because one or more lines are too long
1
p5/addons/p5.sound.min.js.map
Normal file
1
p5/addons/p5.sound.min.js.map
Normal file
File diff suppressed because one or more lines are too long
2
p5/empty-example/.gitignore
vendored
2
p5/empty-example/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
*.html
|
|
||||||
*.js
|
|
Loading…
Reference in New Issue
Block a user