p5.js

Caesar Cipher in p5js

情到浓时终转凉″ 提交于 2021-01-29 02:23:27
问题 I'm a super noob, and I'm trying to make a Caesar cipher in p5js, so far I manage to code the UI, but now I'm stuck and don't really know how to move forward can someone please help? I know I need to use for loops, but I can't figure out how? I really appreciate all the help Thanks let inp; let button; let alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; function setup() { createCanvas(600, 600); //

JavaScript moving an object from starting location to ending location

泪湿孤枕 提交于 2021-01-28 07:37:29
问题 I'm currently taking a course on intro to computer programming. It's an online course and doesn't have much help when you're stuck. I'm using Brackets and p5.js and I'm given a template to start off with. I seem to have done everything needed so far, but I'm not able to animate the spotlight to move. I believe I haven't initialized the spotlight properly but I've tried multiple different ways. If someone could point me in the right direction, I would appreciate it. Code below. Edit the

Importing p5 into a Vue app

感情迁移 提交于 2021-01-27 13:14:12
问题 I added the p5 library into the dom like so... <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>App</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.10/p5.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.10/addons/p5.dom.js"></script> </head> <body> <div id="app"></div> <script src="/dist/build.js"></script> </body> </html> So technically I should be able to grab it via window variable within my Vue code... <template> <div

Collision check between vectors - moving vectors - HTML, JS, P5

大城市里の小女人 提交于 2020-12-26 18:46:57
问题 I have created the collision check function for my player to every time when the object (in this case vector - circle) touches the player (also a vector - circle) the game is over. I have managed to create a logic and there is a collision check working, however it's not calculating the actual distance between elements (instead of ending game when they actually touch its ending when they are some distance from each other. Both objects are moving - obstacle is moving x+=6 and the player is

Collision check between vectors - moving vectors - HTML, JS, P5

假如想象 提交于 2020-12-26 18:46:21
问题 I have created the collision check function for my player to every time when the object (in this case vector - circle) touches the player (also a vector - circle) the game is over. I have managed to create a logic and there is a collision check working, however it's not calculating the actual distance between elements (instead of ending game when they actually touch its ending when they are some distance from each other. Both objects are moving - obstacle is moving x+=6 and the player is

Collision check between vectors - moving vectors - HTML, JS, P5

让人想犯罪 __ 提交于 2020-12-26 18:45:34
问题 I have created the collision check function for my player to every time when the object (in this case vector - circle) touches the player (also a vector - circle) the game is over. I have managed to create a logic and there is a collision check working, however it's not calculating the actual distance between elements (instead of ending game when they actually touch its ending when they are some distance from each other. Both objects are moving - obstacle is moving x+=6 and the player is

Collision check between vectors - moving vectors - HTML, JS, P5

穿精又带淫゛_ 提交于 2020-12-26 18:45:25
问题 I have created the collision check function for my player to every time when the object (in this case vector - circle) touches the player (also a vector - circle) the game is over. I have managed to create a logic and there is a collision check working, however it's not calculating the actual distance between elements (instead of ending game when they actually touch its ending when they are some distance from each other. Both objects are moving - obstacle is moving x+=6 and the player is

How do I add p5.sound to React using react-p5-wrapper?

╄→尐↘猪︶ㄣ 提交于 2020-12-13 05:45:37
问题 I'm trying to get figure how I can include p5.sound to my p5 Sketch. Currently I'm using react-p5-wrapper https://github.com/and-who/react-p5-wrapper/ to get p5 into React. There's a similar issue raised in the repo and I've asked the same question there too, https://github.com/and-who/react-p5-wrapper/issues/11#issuecomment-728986112 but I can't quite figure out the steps they recommended to solve the problem. I've added import * as p5 from "p5" and import "p5/lib/addons/p5.sound" in my

How do I add p5.sound to React using react-p5-wrapper?

╄→尐↘猪︶ㄣ 提交于 2020-12-13 05:45:31
问题 I'm trying to get figure how I can include p5.sound to my p5 Sketch. Currently I'm using react-p5-wrapper https://github.com/and-who/react-p5-wrapper/ to get p5 into React. There's a similar issue raised in the repo and I've asked the same question there too, https://github.com/and-who/react-p5-wrapper/issues/11#issuecomment-728986112 but I can't quite figure out the steps they recommended to solve the problem. I've added import * as p5 from "p5" and import "p5/lib/addons/p5.sound" in my

p5js: How do I make my randomly generated circle packing sketch/canvas responsive when the window is resized?

限于喜欢 提交于 2020-12-13 04:58:05
问题 When I load the window from a narrow size and make it wider, the added canvas space is white. Canvas resize from narrow to wide: When I load from a larger window to a smaller size, the canvas stays in the larger size, while HTML and CSS elements respond. In the second picture, the circles are supposed to cut off at the same point at the black rectangle. I think this is happening because the circles are randomly generated and the layout of them is different whenever the page loads/reloads.