Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【项目推荐】一个在网页上编写代码以画图的编辑器P5.js-web-editor #2727

Open
RuimingShen opened this issue Apr 14, 2024 · 0 comments

Comments

@RuimingShen
Copy link

RuimingShen commented Apr 14, 2024

推荐项目

  • 类别:JS
  • 项目标题:p5.js-web-editor
  • 项目描述:利用p5自己的在线网页编辑器,使用sketch.js来编写代码,并生成图形,p5也自己制作了一些可供调用的方法,这也可以让人和生成的图形进行交互,比如说keyisDown()方法可以让生成的图形对按下屏幕的按键做出反应。详细的p5自研方法在p5网站的reference部分。
  • 亮点:可以通过p5独创的方法描绘图形并进行交互。

  • 示例代码:(可选)

let y = 100;

function setup() {
  createCanvas(512, 512);
  fill(255, 0, 0);
}

function draw() {
  if (keyIsDown(LEFT_ARROW)) {
    x -= 5;
  }

  if (keyIsDown(RIGHT_ARROW)) {
    x += 5;
  }

  if (keyIsDown(UP_ARROW)) {
    y -= 5;
  }

  if (keyIsDown(DOWN_ARROW)) {
    y += 5;
  }

  clear();
  ellipse(x, y, 50, 50);
  describe(`50-by-50 red ellipse moves left, right, up, and
    down with arrow presses.`);
}
  • 截图:(可选)gif/png/jpg

  • 后续更新计划:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants