Skip to content

Instantly share code, notes, and snippets.

#include <Servo.h>;
Servo servo;
const int servoPin = 8;
const int buttonPin = 13;
boolean isHit = false;
boolean isMoving = true;
@zawa-works
zawa-works / GetCirclesCrossPoints.pde
Last active January 5, 2020 17:34
円と円の交点を求めるプログラム
float x1, y1, r1;
float x2, y2, r2;
void setup() {
size(640, 360);
x1 = width/2;
y1 = height/2;
r1 = 100;
r2 = 110;
@zawa-works
zawa-works / UsingClassInSecondWindow.pde
Created December 7, 2019 07:17
2番目の画面内でクラスを使うときの注意
SecondWindow secondWindow;
void settings() {
size(200, 200);
}
void setup() {
secondWindow = new SecondWindow();
}
@zawa-works
zawa-works / GetCrossPointBetweenCircleLine.pde
Last active December 3, 2019 16:15
円と線の交点を求めたプログラム
float x1, y1, x2, y2;//直線の端の座標
int circleX, circleY, circleRadius;//円の中心座標と半径
void setup() {
size(1280, 720);
//円の中心座標と半径を代入
circleX = width/2;
circleY = height/2;
circleRadius = 150;
ArrayList<Bubble>bubbles = new ArrayList();
float birthPosX, birthPosY;
int frameCount;
boolean startable;
void setup() {
size(640, 360);
background(#ffffff);
frameRate(20);
}
ArrayList<EasingBall> easingBall = new ArrayList();
int frameCount;
void setup() {
size(640, 360);
for (int i = 0; i < 50; i++) {
EasingBall eb = new EasingBall();
eb.setRadius(20 - (i/10));
eb.setColor((int)random(#000000, #ffffff));
easingBall.add(eb);
ArrayList<Sentence> sentences;
String[] strs = {
"人間、失格。",
"もはや、自分は、",
"完全に、人間で無くなりました。"
};
PFont font;
int fontSize = 30;
int margin = 20;
color[]c = {#74F2CE, #A1E44D, #6CCFF6, #CC4BC2, #EF8354, #F84AA7};
void setup() {
size(480, 270);
background(#ffffff);
frameRate(30);
}
void draw() {
background(#ffffff);
LeaveBall[] ball = new LeaveBall[500];
int frameCount;
void setup() {
fullScreen();
for (int i = 0; i < ball.length; i++) {
ball[i] = new LeaveBall(random(width), random(height));
ball[i].setColor((int)random(#000000, #ffffff));
}
}
//ひし形をクリックすると色が変わる
PileDiamond[]pdiamond = new PileDiamond[45];
void setup() {
size(640, 360);
for (int i = 0; i < pdiamond.length; i++) pdiamond[i] = new PileDiamond(160, 90);
}
void draw() {
background(-1);