質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Processing

Processingは、オープンソースプロジェクトによるCGのためのプログラミング言語です。Javaをベースにしており、グラフィック機能に特化しています。イメージの生成やアニメーションなど、視覚的なフィードバックを簡単に得ることが可能です。

Q&A

0回答

727閲覧

p5jsからprocessingへのコードの移植について

退会済みユーザー

退会済みユーザー

総合スコア0

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Processing

Processingは、オープンソースプロジェクトによるCGのためのプログラミング言語です。Javaをベースにしており、グラフィック機能に特化しています。イメージの生成やアニメーションなど、視覚的なフィードバックを簡単に得ることが可能です。

0グッド

0クリップ

投稿2020/01/26 00:44

open processingでpatatap的なものを作りましたが、midiの信号を受け取るためにprocessingに移植しないといけないのですが、open processingで書いたスクリプトがprocesssingで機能しません、具体的にどのような変更を加えると動きますか。

var x = 0;
var y = 0;
let sample = [];
let bgcolor;
let animation = [];
let num;

function preload(){
sample[0] = loadSound('13_ATH_Snare.wav');
sample[1] = loadSound('Decibel_Vol_2_-_Open_Hat_08.wav');
sample[2] = loadSound('FL_TS_Crash_02.wav');
sample[3] = loadSound('Snare_1.wav');
sample[4] = loadSound('Snare_06.wav');
sample[5] = loadSound('1Snare.wav');
sample[6] = loadSound('Clap_Snappy.wav');
sample[7] = loadSound('Synth_Single_Hit_11_F.wav');
sample[8] = loadSound('TapedUpProphet_Fmaj7_hit.wav');
sample[9] = loadSound('Synth_Single_Hit_42_Eb.wav');
sample[10] = loadSound('VGP_VC1_Hit.wav');
sample[11] = loadSound('Synth_Hit_14.wav');
sample[12] = loadSound('Synth_Hit_09.wav');
sample[13] = loadSound('WAFHVE_Kick_That_Shit_Solo_Hard3.wav');
sample[14] = loadSound('WAFHVE_Hit_Me_Layered_Hard.wav');
sample[15] = loadSound('WAVSE_Hit_The_Crowd_LAYERED_Soft_128bpm.wav');
}

function setup(){
createCanvas(windowWidth,windowHeight);
}

function draw(){
background(0);
if (animation.length > 0) {
for (let i = 0; i < animation.length; i++){
animation[i].draw();
}
}
}

function keyTyped(){
if(key == 'a'){
sample[0].play();
animation.push(new Anim_a());
}else if(key == 's'){
sample[1].play();
animation.push(new Anim_s());
}else if(key == 'd'){
sample[2].play();
animation.push(new Anim_d());
}else if(key == 'f'){
sample[3].play();
animation.push(new Anim_f());
}else if(key == 'z'){
sample[4].play();
animation.push(new Anim_z());
}else if(key == 'x'){
sample[5].play();
animation.push(new Anim_x());
}else if(key == 'c'){
sample[6].play();
animation.push(new Anim_c());
}else if(key == 'v'){
sample[7].play();
animation.push(new Anim_v());
}else if(key == 'h'){
sample[8].play();
animation.push(new Anim_h());
}else if(key == 'j'){
sample[9].play();
animation.push(new Anim_j());
}else if(key == 'k'){
sample[10].play();
animation.push(new Anim_k());
}else if(key == 'l'){
sample[11].play();
animation.push(new Anim_l());
}else if(key == 'u'){
sample[12].play();
animation.push(new Anim_u());
}else if(key == 'i'){
sample[13].play();
animation.push(new Anim_i());
}else if(key == 'o'){
sample[14].play();
animation.push(new Anim_o());
}else if(key == 'p'){
sample[15].play();
animation.push(new Anim_p());
}
if(animation.length > 4){
animation.splice( 1, 1);
}
}
class Anim_a{
constructor(){
this.x = width / 2;
this.y = height /2;
this.diameter = 0;
this.speed = 10;
}
draw(){
noStroke();
fill(random(100),random(255),random(50));
ellipse(this.x,this.y,this.diameter,this.diameter);
this.diameter += this.speed;
}
}

class Anim_s{
constructor(){
this.width = 0;
this.speed = 100;
}
draw(){
noStroke();
fill(random(255),0,0);
rectMode(CORNER);
rect(0,0,this.width,height);
this.width += this.speed;
}
}
class Anim_d{
constructor(){
this.rotate = 0;
this.speed = 50;
}
draw(){
push();
fill(255,255,0);
noStroke();
translate(width / 2,height /2);
rotate(radians(this.rotate));
rectMode(CENTER);
rect(0,0,250,250);
pop();
this.rotate += this.speed;
}
}
class Anim_f{
constructor(){
this.bgColor = 255;
this.speed = -2;
}
draw(){
noStroke();
fill(this.bgColor);
rect(0,0,width,height);
this.bgColor += this.speed;
}
}
class Anim_z{
constructor(){
this.height = 0;
this.speed = 60;
}
draw(){
noStroke();
fill(random(100),random(150),random(200));
rectMode(CORNER);
rect(0,0,width,this.height);
this.height += this.speed;
}
}
class Anim_x{
constructor(){
this.rotate = 0;
this.size = 0
this.speed = 5;
}
draw(){
fill(0,255,225);
noStroke();
push();
translate(width / 2,height / 2);
rotate(random(this.rotate));
ellipse(180,180,80,80);
this.rotate += this.speed;
pop();
}
}
class Anim_c{
constructor(){
this.rotate = 0;
this.size = 0;
this.speed = 150;
}
draw(){
fill(random(200),random(200),100);
noStroke();
push();
translate(width / 2,height / 2);
rotate(radians(this.rotate));
ellipse(-90,0,180,50);
this.rotate += this.speed;
pop();
}
}
class Anim_v{
constructor(){
this.size = 0;
this.speed = 10;
var x = 0;
}
draw(){
fill(0,105,125);
noStroke();
rectMode
rect(x,x,this.size,this.size);
this.size += this.speed;
x += this.speed;
}
}
class Anim_h{
constructor(){
this.bgColor = 255;
this.speed = -2;
}
draw(){
noStroke();
fill(this.bgColor);
rect(0,0,width,height);
this.bgColor += this.speed;
}
}
class Anim_j{
constructor(){
this.rotate = 0;
this.speed = 10;
this.size = 0;
}
draw(){
noStroke();
fill(random(255),random(125),125);
push();
translate(width / 2,height /2);
rotate(radians(this.rotate));
rect(0,0,this.size,this.size);
rectMode(CENTER);
this.rotate += this.speed;
this.size += this.speed;
pop();
}
}
class Anim_k{
constructor(){
this.width = 0;
this.speed = 80;
}
draw(){
noStroke();
fill(200,120,100);
rectMode(CORNER);
rect(0,0,this.width,height);
this.width += this.speed;
}
}
class Anim_l{
constructor(){
this.rotate = 0;
this.speed = 150;
}
draw(){
fill(70,65,180);
noStroke();
push();
translate(width / 2,height / 2);
rotate(radians(this.rotate));
triangle(0,-180,180,180,-180,180);
this.rotate += this.speed;
this.size += this.speed;
pop();
}
}
class Anim_u{
constructor(){
this.size = 0;
this.speed = 50;
}
draw(){
noStroke();
fill(200,50,50);
rectMode(CORNER);
rect(0,0,this.size,this.size);
this.size += this.speed;
}
}
class Anim_i{
constructor(){
this.size = 0;
this.rotate = 0;
this.speed = 30;
}
draw(){
fill(100,70,80);
noStroke();
push();
translate(width / 2,height / 2);
rotate(radians(this.rotate));
rectMode(CENTER);
rect(0,0,this.size,this.size);
pop();
this.rotate += this.speed;
this.size += this.speed;
}
}
class Anim_o{
constructor(){
this.rotate = 0;
this.speed = 150;
this.size = 0;
}
draw(){
fill(0,255,0);
noStroke();
push();
translate(width / 2,height / 2);
rotate(radians(this.rotate));
triangle(175,-180,5,175,-175,175);
this.rotate += this.speed;
this.size += this.speed;
pop();
}
}
class Anim_p{
constructor(){
this.rotate = 0;
this.size = 0;
this.speed = 70;
}
draw(){
background(0);
noStroke();
push();
translate(width / 2,height / 2);
rotate(random(this.rotate));
rect(0,0,this.size,this.size);
this.size += this.speed;
this.rotate += this.speed;
pop();
}
}

試したこと

一応わかるところはprocessingの構成に直したり、ブロックごとに分けアニメーションが動くか試したのですが、やはり動きませんでした。

補足情報(FW/ツールのバージョンなど)

p5jsからprocessing2.2.1への移行です。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

thkana

2020/01/26 01:47

質問の趣旨がいまいちわかりかねるのですが、 自分がやって上手く行かなかったから、その解析の情報は全くなしに、 回答者がこのプログラムをJava版のProcessing(2.2.1)に移植しろ、 ということですか?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問