求助大佬 有几行代码不会转化可以帮助一下吗 或者去哪里可以学到更
processing吧
全部回复
仅看楼主
level 2
let str = "InVerse = Our Personalised Communication Language";
let str_arr = [];
let font;
let sdgreg;
function preload() {
font = loadFont("SpaceGrotesk-Bold.otf");
}
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
colorMode(HSB, 360, 100, 100, 100);
let strs = str.split(" ");
for (let i = 0; i < strs.length*20; i++) {
let x = random(-width / 2, width / 2);
let y = random(-height / 2, height / 2);
let z = random(-width*5, width/2);
str_arr.push(new Type(strs[i%strs.length], x, y, z));
}
}
function draw() {
background(0,0,0);
orbitControl();
for (let i = 0; i < str_arr.length; i++) {
str_arr[i].update();
str_arr[i].display();
}
}
class Type {
constructor(_str, _x, _y, _z) {
网页链接 = _str;
this.x = _x;
this.y = _y;
this.z = _z;
}
update() {
this.z += 10;
if(this.z > width/2){
this.z = -width*5;
}
}
display() {
push();
translate(this.x, this.y, this.z);
textAlign(CENTER, CENTER);
textFont(font);
textSize(100);
fill(0,0,100);
text(this.str, 0, 0);
pop();
}
}
2022年04月25日 09点04分 1
level 2
String str = "Processing & Shader Joy ~";
ArrayList<Type> str_arr = new ArrayList<Type>();
PFont font;
//let sdgreg;
void preload() {
font = createFont("cmb10.ttf", 97);
//font = loadFont("LetterGothicStd-32.vlw");
}
void setup() {
size(640, 480, P3D);
preload();
String[] strs = str.split(" ");
/// @note 随机添加单词
for (int i = 0; i < strs.length*20; i++) {
float x = random(-width / 2, width / 2);
float y = random(-height / 2, height / 2);
float z = random(-width*5, width/2);
str_arr.add(new Type(strs[i%strs.length], x, y, z));
}
}
void draw() {
background(0,0,0);
translate(width/2, height/2);
for (int i = 0; i < strs.length; i++) {
strs[i].updatePixels();
strs[i].display();
}
}
class Type {
constructor(_str, _x, _y, _z) {
网页链接 = _str;
this.x = _x;
this.y = _y;
this.z = _z;
}
updatePixels() {
this.z += 10;
if(this.z > width/2){
this.z = -width*5;
}
}
display() {
push();
translate(this.x, this.y, this.z);
textAlign(CENTER, CENTER);
textFont(font);
textSize(100);
fill(0,0,100);
text(this.str, 0, 0);
pop();
}
}
2022年04月25日 09点04分 2
level 2
我只转化了一半 最后draw 后面总是出错
2022年04月25日 09点04分 3
1