12mB1
の編集
https://lab.yoneyone.net/php/pukiwiki/index.php?12mB1
[
トップ
] [
編集
|
差分
|
履歴
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
(no template pages)
*12membersTeamB1 [#bf7b6e43] **members [#t1fd3530] >[[伊納>12_Inou]] [[西中>12_Nishinaka]] [[福田>12_Fukuda]] [[矢橋>11_Yahashi]] (敬称略)~ ~ **前話したこと [#df920cce] --目覚まし(移動、物理)、快適な睡眠(視覚、聴覚) **そこそこ決まったこと [#ke820bb3] -やること→目覚まし時計 --センサーを使ってレム睡眠、ノンレム睡眠を疑似的に感知 --気持ちよく起きれるとき(レム睡眠)に起こす -必要なもの --PC --Arduino --センサー(加速度?曲げ?etx…) --装飾系統 **時計のプログラム [#m15f07e6] -合宿に行けそうにないんで… --時計表示の実装 --時間指定らしきものの実装 --アラーム機能仮実装(ファイルを指定したら音出ます。いちおう文字で「GetUp!」って表示します) --音声ファイルはプログラムのファイルと同じディレクトリに「data」ってディレクトリを作ってその中に突っ込んでください。 --その音声ファイルの名前を上段の「setup(){・・・}」下段の「Stopボタンの判定」付近に記述したらたぶんできると思います。 --あと必要そうなのセンサーとの兼ね合いetc… --センサーとの兼ね合いは見当もつかないんで全く触れてませんのであしからず。 import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; Minim minim; AudioPlayer song; int MARGIN = 20; Clock myClock = new Clock(); int time1 = 0; int time2 = 0; void setup() { size(700,500); minim = new Minim(this); song = minim.loadFile(".mp3");//指定のファイル名 smooth(); frameRate(30); } void draw() { stroke(255); background(0); myClock.getTime(); myClock.draw(); } class Clock { float s, m, h; Clock(){ } void getTime(){ s = second(); m = minute() + (s/60.0); h = hour()%12 + (m/60.0); } void draw(){ fill(255); //指定の時間になったら音と文字がでる if(time1==hour() & time2==minute()){ if(song.isPlaying()){ }else{ song.play(); } text("Get up!!",500,400); } //右側の指定時間描画 fill(255); rect(450,200,120,40); fill(0); stroke(0); ellipse(510,212,2,2); ellipse(510,230,2,2); fill(255); stroke(255); int a=470; int b=185; rect(465,175,20,15); rect(465+60,175,20,15); rect(465,175+75,20,15); rect(465+60,175+75,20,15); stroke(0); fill(0); triangle(a,b,a+8,b,a+4,b-5); triangle(a,b+70,a+8,b+70,a+4,b+70+5); triangle(a+60,b,a+8+60,b,a+4+60,b-5); triangle(a+60,b+70,a+8+60,b+70,a+4+60,b+70+5); textSize(38); text(nf(time1,2),455,235); text(nf(time2,2),455+60,235); int lenge = 200; //ストップボタン fill(255); rect(460,95,100,45); fill(0); textSize(38); text("Stop",470,130); //点の描画 translate(lenge, lenge); rotate(radians(180)); pushMatrix(); fill(128); noStroke(); for(int i=0; i<60; i++){ rotate(radians(6)); ellipse(lenge-MARGIN,0,3,3); } for(int i=0; i<12; i++){ rotate(radians(30)); ellipse(lenge-MARGIN,0,10,10); } //針の描画 popMatrix(); noFill(); stroke(255); pushMatrix(); rotate(radians(s*(360/60))); strokeWeight(1); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(m*(360/60))); strokeWeight(2); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(h*(360/12))); strokeWeight(4); line(0,0,0,(lenge*3)/4-MARGIN); popMatrix(); } } void mousePressed(){ //時間指定 if(mouseX>465 & mouseX<485){ if(mouseY>175 & mouseY<190){ if(time1<23){ time1++; }else if(time1==23){ time1=0; } }else if(mouseY>250 & mouseY<265){ if(time1>0){ time1--; }else if(time1==0){ time1=23; } } } if(mouseX>465+60 & mouseX<485+60){ if(mouseY>175 & mouseY<190){ if(time2<59){ time2++; }else if(time2==59){ time2=0; } }else if(mouseY>250 & mouseY<265){ if(time2>0){ time2--; }else if(time2==0){ time2=59; } } } //Stopボタンの判定(音が止まる) if(mouseX>460 & mouseX<560 & mouseY>95 & mouseY<140){ song.close(); song = minim.loadFile(".mp3");//指定の音声ファイル(上と同じ推奨?) } } void stop(){ song.close(); minim.stop(); super.stop(); } **会議場 [#w094d83b] >直接あって話とか、メールとか、合宿前までに設定するの面倒だと思うので。 - とりあえず最低限のことは書いたつもり。不足等あればコメントないし直接変更をしてください。 -- [[西中]] &new{2012-05-11 (金) 01:57:20}; - 各班4回生はすごい準備しているぞ~危機感もったほうがいいぞ -- [[なか]] &new{2012-05-17 (木) 16:54:34}; - 時間判定を追加 -- [[西中]] &new{2012-05-19 (土) 01:42:39}; - とりあえず基本的な目ざまし時計としての体裁は出来ていると思います。 -- [[西中]] &new{2012-05-19 (土) 02:23:55}; - 申し訳ないですが後はよろしくお願いします。 -- [[西中]] &new{2012-05-19 (土) 02:24:43}; - 時間判定を追加 -- [[西中]] &new{2012-05-19 (土) 02:33:27}; - 時計まわり丸々いただきました。すげぇ -- [[12_Inou]] &new{2012-05-20 (日) 15:16:03}; - プログラム系全般ありがとう!ちょっとだけかしこくなりました!合宿お疲れさまでした。 -- [[ふくだ]] &new{2012-05-20 (日) 22:53:19}; - [[福田さん>12_Fukuda]]、完成した例のブツの写真を[[このへん:http://lab.yoneyone.net/php/pukiwiki/index.php?plugin=attach&pcmd=upload&page=12mB1]]に上げといていただけないでしょうか -- [[12_Inou]] &new{2012-05-21 (月) 01:14:30}; #comment [[12members]] * 実機のコード [#x11f621f] ** Arduino [#gec53e36] void setup(){ pinMode(2,INPUT); pinMode(3,OUTPUT); Serial.begin(9600); } int value = 0; boolean before = false; long beforeTime = 0; void loop(){ if(digitalRead(2) == HIGH){ //もし今光っていて if(before){ //もし一回前のループで光っていた //なら変化なし if(micros() - beforeTime > 1000000){ digitalWrite(3,LOW);//青LED消灯 Serial.print(0); } }else{ //一回前のループで光っていなかった //なら変化した if(micros() - beforeTime > 1000000){ //寝返り打った?レム睡眠だ! digitalWrite(3,HIGH); //青LED光らせる Serial.print(1); } beforeTime = micros(); } before = true; //今回のループでは光った }else{ //今のループで光っていなくて if(before){ //もし一回前のループで光っていた if(micros() - beforeTime > 1000000){ //変化した //寝返り打った?レム睡眠だ! digitalWrite(3,HIGH); //青LED点灯 Serial.print(1); } beforeTime = micros(); }else{ //一回前光っていなかったら if(micros() - beforeTime > 1000000){ //変化なし digitalWrite(3,LOW); //青LED消灯 Serial.print(0); } } before = false; //今回のループでは光っていなかった } } ** Processing [#n0589c0d] import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import processing.serial.*; Serial arduino; Clock clock; Minim minim; AudioPlayer song; int[] millisAry = {0}; String[] lineAry = {"time,ms,dif"}; boolean isRem(int[] ary){ int average = 0; int temp = 0; for(int i=ary.length-1; i>0; i--){ temp = temp + ary[i]; if(temp >= 5*60*1000){ //5分前の記録まで読み込む average = temp/(ary.length - i); break; } } if(average < 5*60*1000/5){ //5分間に5回の動きを検出した return true; } return false; } //EventHandlers///////////////////////////////////////////////////////////// void setup(){ println(Serial.list()); arduino = new Serial(this,Serial.list()[2],9600); minim = new Minim(this); song = minim.loadFile("GET UP - Sergej Smile.mp3"); clock = new Clock(); size(700,500); smooth(); frameRate(30); } void draw(){ background(0); clock.checkAlarm(isRem(millisAry)); clock.refresh(); } void serialEvent(Serial p){ if(arduino.read() == 49){ int[] tempAry = new int[millisAry.length+1]; int temp = 0; for(int i=0; millisAry.length>i; i++){ tempAry[i] = millisAry[i]; temp = temp + tempAry[i]; } tempAry[millisAry.length] = millis() - temp; millisAry = tempAry; //write log String[] tempAry2 = new String[lineAry.length+1]; for(int i=0; lineAry.length>i; i++){ tempAry2[i] = lineAry[i]; } tempAry2[lineAry.length] = nf(hour(),2)+":"+nf(minute(),2)+","+millis()+","+millisAry[millisAry.length-1]; lineAry = tempAry2; println(lineAry[lineAry.length-1]); saveStrings("log"+year()+"-"+month()+"-"+day()+".csv",lineAry); } } //ClockClass///////////////////////////////////////////////////////////// class Clock{ float s,m,h; int alarmHour = 6; int alarmMinute = 0; boolean isAlarmSet = true; Clock(){ this.getTime(); } void refresh(){ this.getTime(); this.draw(); } void getTime(){ s = second(); m = minute() + (s/60); h = hour()%12 + (m/60); } void checkAlarm(boolean isRem){ if(isRem && this.isAlarmSet && abs((hour()*60 + minute()) - (this.alarmHour*60 + this.alarmMinute)) < 90){ if(song.isPlaying() == false){ song.play(); } fill(255,0,0); textSize(38); text("Wake up!!",425,65); } } void draw(){ //右側の指定時間描画 //[6:00] stroke(255); fill(255); rect(450,200,120,40); stroke(0); fill(0); ellipse(510,212,2,2); ellipse(510,230,2,2); textSize(38); text(nf(this.alarmHour,2),455,235); text(nf(this.alarmMinute,2),455+60,235); //[A][V] stroke(255); fill(255); rect(465,175,20,15); rect(465+60,175,20,15); rect(465,175+75,20,15); rect(465+60,175+75,20,15); int a = 470; int b = 185; stroke(0); fill(0); triangle(a,b,a+8,b,a+4,b-5); triangle(a,b+70,a+8,b+70,a+4,b+70+5); triangle(a+60,b,a+8+60,b,a+4+60,b-5); triangle(a+60,b+70,a+8+60,b+70,a+4+60,b+70+5); if(mousePressed){ if(mouseX > 465 && mouseX < 485){//時間時指定 if(mouseY > 175 && mouseY < 190){//[A] if(this.alarmHour < 23){ this.alarmHour += 1; }else{ this.alarmHour = 0; } this.isAlarmSet = true; delay(100); }else if(mouseY > 250 && mouseY < 265){//[V] if(this.alarmHour > 0){ this.alarmHour -= 1; }else{ this.alarmHour = 23; } this.isAlarmSet = true; delay(100); } }else if(mouseX > 465 + 60 && mouseX < 485 + 60){//時間分指定 if(mouseY > 175 && mouseY < 190){//[A] if(this.alarmMinute < 59){ this.alarmMinute += 1; }else{ this.alarmMinute = 0; } this.isAlarmSet = true; delay(100); }else if(mouseY>250 && mouseY<265){//[V] if(this.alarmMinute > 0){ this.alarmMinute -= 1; }else{ this.alarmMinute = 59; } this.isAlarmSet = true; delay(100); } } } //[STOP] stroke(255); fill(255); rect(460,95,100,45); stroke(0); fill(0); textSize(38); text("Stop",470,130); if(mousePressed){ if(mouseX>460 && mouseX<560 && mouseY>95 && mouseY<140){ this.isAlarmSet = false; song.close(); song = minim.loadFile("GET UP - Sergej Smile.mp3"); } } //clock int lenge = 200; int MARGIN = 20; //点の描画 translate(lenge, lenge); rotate(radians(180)); pushMatrix(); strokeWeight(0); fill(128); for(int i=0; i<60; i++){ rotate(radians(6)); ellipse(lenge-MARGIN,0,3,3); } for(int i=0; i<12; i++){ rotate(radians(30)); ellipse(lenge-MARGIN,0,10,10); } //針の描画 popMatrix(); stroke(255); pushMatrix(); rotate(radians(s*(360/60))); strokeWeight(1); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(m*(360/60))); strokeWeight(2); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(h*(360/12))); strokeWeight(4); line(0,0,0,(lenge*3)/4-MARGIN); popMatrix(); } }
タイムスタンプを変更しない
*12membersTeamB1 [#bf7b6e43] **members [#t1fd3530] >[[伊納>12_Inou]] [[西中>12_Nishinaka]] [[福田>12_Fukuda]] [[矢橋>11_Yahashi]] (敬称略)~ ~ **前話したこと [#df920cce] --目覚まし(移動、物理)、快適な睡眠(視覚、聴覚) **そこそこ決まったこと [#ke820bb3] -やること→目覚まし時計 --センサーを使ってレム睡眠、ノンレム睡眠を疑似的に感知 --気持ちよく起きれるとき(レム睡眠)に起こす -必要なもの --PC --Arduino --センサー(加速度?曲げ?etx…) --装飾系統 **時計のプログラム [#m15f07e6] -合宿に行けそうにないんで… --時計表示の実装 --時間指定らしきものの実装 --アラーム機能仮実装(ファイルを指定したら音出ます。いちおう文字で「GetUp!」って表示します) --音声ファイルはプログラムのファイルと同じディレクトリに「data」ってディレクトリを作ってその中に突っ込んでください。 --その音声ファイルの名前を上段の「setup(){・・・}」下段の「Stopボタンの判定」付近に記述したらたぶんできると思います。 --あと必要そうなのセンサーとの兼ね合いetc… --センサーとの兼ね合いは見当もつかないんで全く触れてませんのであしからず。 import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; Minim minim; AudioPlayer song; int MARGIN = 20; Clock myClock = new Clock(); int time1 = 0; int time2 = 0; void setup() { size(700,500); minim = new Minim(this); song = minim.loadFile(".mp3");//指定のファイル名 smooth(); frameRate(30); } void draw() { stroke(255); background(0); myClock.getTime(); myClock.draw(); } class Clock { float s, m, h; Clock(){ } void getTime(){ s = second(); m = minute() + (s/60.0); h = hour()%12 + (m/60.0); } void draw(){ fill(255); //指定の時間になったら音と文字がでる if(time1==hour() & time2==minute()){ if(song.isPlaying()){ }else{ song.play(); } text("Get up!!",500,400); } //右側の指定時間描画 fill(255); rect(450,200,120,40); fill(0); stroke(0); ellipse(510,212,2,2); ellipse(510,230,2,2); fill(255); stroke(255); int a=470; int b=185; rect(465,175,20,15); rect(465+60,175,20,15); rect(465,175+75,20,15); rect(465+60,175+75,20,15); stroke(0); fill(0); triangle(a,b,a+8,b,a+4,b-5); triangle(a,b+70,a+8,b+70,a+4,b+70+5); triangle(a+60,b,a+8+60,b,a+4+60,b-5); triangle(a+60,b+70,a+8+60,b+70,a+4+60,b+70+5); textSize(38); text(nf(time1,2),455,235); text(nf(time2,2),455+60,235); int lenge = 200; //ストップボタン fill(255); rect(460,95,100,45); fill(0); textSize(38); text("Stop",470,130); //点の描画 translate(lenge, lenge); rotate(radians(180)); pushMatrix(); fill(128); noStroke(); for(int i=0; i<60; i++){ rotate(radians(6)); ellipse(lenge-MARGIN,0,3,3); } for(int i=0; i<12; i++){ rotate(radians(30)); ellipse(lenge-MARGIN,0,10,10); } //針の描画 popMatrix(); noFill(); stroke(255); pushMatrix(); rotate(radians(s*(360/60))); strokeWeight(1); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(m*(360/60))); strokeWeight(2); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(h*(360/12))); strokeWeight(4); line(0,0,0,(lenge*3)/4-MARGIN); popMatrix(); } } void mousePressed(){ //時間指定 if(mouseX>465 & mouseX<485){ if(mouseY>175 & mouseY<190){ if(time1<23){ time1++; }else if(time1==23){ time1=0; } }else if(mouseY>250 & mouseY<265){ if(time1>0){ time1--; }else if(time1==0){ time1=23; } } } if(mouseX>465+60 & mouseX<485+60){ if(mouseY>175 & mouseY<190){ if(time2<59){ time2++; }else if(time2==59){ time2=0; } }else if(mouseY>250 & mouseY<265){ if(time2>0){ time2--; }else if(time2==0){ time2=59; } } } //Stopボタンの判定(音が止まる) if(mouseX>460 & mouseX<560 & mouseY>95 & mouseY<140){ song.close(); song = minim.loadFile(".mp3");//指定の音声ファイル(上と同じ推奨?) } } void stop(){ song.close(); minim.stop(); super.stop(); } **会議場 [#w094d83b] >直接あって話とか、メールとか、合宿前までに設定するの面倒だと思うので。 - とりあえず最低限のことは書いたつもり。不足等あればコメントないし直接変更をしてください。 -- [[西中]] &new{2012-05-11 (金) 01:57:20}; - 各班4回生はすごい準備しているぞ~危機感もったほうがいいぞ -- [[なか]] &new{2012-05-17 (木) 16:54:34}; - 時間判定を追加 -- [[西中]] &new{2012-05-19 (土) 01:42:39}; - とりあえず基本的な目ざまし時計としての体裁は出来ていると思います。 -- [[西中]] &new{2012-05-19 (土) 02:23:55}; - 申し訳ないですが後はよろしくお願いします。 -- [[西中]] &new{2012-05-19 (土) 02:24:43}; - 時間判定を追加 -- [[西中]] &new{2012-05-19 (土) 02:33:27}; - 時計まわり丸々いただきました。すげぇ -- [[12_Inou]] &new{2012-05-20 (日) 15:16:03}; - プログラム系全般ありがとう!ちょっとだけかしこくなりました!合宿お疲れさまでした。 -- [[ふくだ]] &new{2012-05-20 (日) 22:53:19}; - [[福田さん>12_Fukuda]]、完成した例のブツの写真を[[このへん:http://lab.yoneyone.net/php/pukiwiki/index.php?plugin=attach&pcmd=upload&page=12mB1]]に上げといていただけないでしょうか -- [[12_Inou]] &new{2012-05-21 (月) 01:14:30}; #comment [[12members]] * 実機のコード [#x11f621f] ** Arduino [#gec53e36] void setup(){ pinMode(2,INPUT); pinMode(3,OUTPUT); Serial.begin(9600); } int value = 0; boolean before = false; long beforeTime = 0; void loop(){ if(digitalRead(2) == HIGH){ //もし今光っていて if(before){ //もし一回前のループで光っていた //なら変化なし if(micros() - beforeTime > 1000000){ digitalWrite(3,LOW);//青LED消灯 Serial.print(0); } }else{ //一回前のループで光っていなかった //なら変化した if(micros() - beforeTime > 1000000){ //寝返り打った?レム睡眠だ! digitalWrite(3,HIGH); //青LED光らせる Serial.print(1); } beforeTime = micros(); } before = true; //今回のループでは光った }else{ //今のループで光っていなくて if(before){ //もし一回前のループで光っていた if(micros() - beforeTime > 1000000){ //変化した //寝返り打った?レム睡眠だ! digitalWrite(3,HIGH); //青LED点灯 Serial.print(1); } beforeTime = micros(); }else{ //一回前光っていなかったら if(micros() - beforeTime > 1000000){ //変化なし digitalWrite(3,LOW); //青LED消灯 Serial.print(0); } } before = false; //今回のループでは光っていなかった } } ** Processing [#n0589c0d] import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import processing.serial.*; Serial arduino; Clock clock; Minim minim; AudioPlayer song; int[] millisAry = {0}; String[] lineAry = {"time,ms,dif"}; boolean isRem(int[] ary){ int average = 0; int temp = 0; for(int i=ary.length-1; i>0; i--){ temp = temp + ary[i]; if(temp >= 5*60*1000){ //5分前の記録まで読み込む average = temp/(ary.length - i); break; } } if(average < 5*60*1000/5){ //5分間に5回の動きを検出した return true; } return false; } //EventHandlers///////////////////////////////////////////////////////////// void setup(){ println(Serial.list()); arduino = new Serial(this,Serial.list()[2],9600); minim = new Minim(this); song = minim.loadFile("GET UP - Sergej Smile.mp3"); clock = new Clock(); size(700,500); smooth(); frameRate(30); } void draw(){ background(0); clock.checkAlarm(isRem(millisAry)); clock.refresh(); } void serialEvent(Serial p){ if(arduino.read() == 49){ int[] tempAry = new int[millisAry.length+1]; int temp = 0; for(int i=0; millisAry.length>i; i++){ tempAry[i] = millisAry[i]; temp = temp + tempAry[i]; } tempAry[millisAry.length] = millis() - temp; millisAry = tempAry; //write log String[] tempAry2 = new String[lineAry.length+1]; for(int i=0; lineAry.length>i; i++){ tempAry2[i] = lineAry[i]; } tempAry2[lineAry.length] = nf(hour(),2)+":"+nf(minute(),2)+","+millis()+","+millisAry[millisAry.length-1]; lineAry = tempAry2; println(lineAry[lineAry.length-1]); saveStrings("log"+year()+"-"+month()+"-"+day()+".csv",lineAry); } } //ClockClass///////////////////////////////////////////////////////////// class Clock{ float s,m,h; int alarmHour = 6; int alarmMinute = 0; boolean isAlarmSet = true; Clock(){ this.getTime(); } void refresh(){ this.getTime(); this.draw(); } void getTime(){ s = second(); m = minute() + (s/60); h = hour()%12 + (m/60); } void checkAlarm(boolean isRem){ if(isRem && this.isAlarmSet && abs((hour()*60 + minute()) - (this.alarmHour*60 + this.alarmMinute)) < 90){ if(song.isPlaying() == false){ song.play(); } fill(255,0,0); textSize(38); text("Wake up!!",425,65); } } void draw(){ //右側の指定時間描画 //[6:00] stroke(255); fill(255); rect(450,200,120,40); stroke(0); fill(0); ellipse(510,212,2,2); ellipse(510,230,2,2); textSize(38); text(nf(this.alarmHour,2),455,235); text(nf(this.alarmMinute,2),455+60,235); //[A][V] stroke(255); fill(255); rect(465,175,20,15); rect(465+60,175,20,15); rect(465,175+75,20,15); rect(465+60,175+75,20,15); int a = 470; int b = 185; stroke(0); fill(0); triangle(a,b,a+8,b,a+4,b-5); triangle(a,b+70,a+8,b+70,a+4,b+70+5); triangle(a+60,b,a+8+60,b,a+4+60,b-5); triangle(a+60,b+70,a+8+60,b+70,a+4+60,b+70+5); if(mousePressed){ if(mouseX > 465 && mouseX < 485){//時間時指定 if(mouseY > 175 && mouseY < 190){//[A] if(this.alarmHour < 23){ this.alarmHour += 1; }else{ this.alarmHour = 0; } this.isAlarmSet = true; delay(100); }else if(mouseY > 250 && mouseY < 265){//[V] if(this.alarmHour > 0){ this.alarmHour -= 1; }else{ this.alarmHour = 23; } this.isAlarmSet = true; delay(100); } }else if(mouseX > 465 + 60 && mouseX < 485 + 60){//時間分指定 if(mouseY > 175 && mouseY < 190){//[A] if(this.alarmMinute < 59){ this.alarmMinute += 1; }else{ this.alarmMinute = 0; } this.isAlarmSet = true; delay(100); }else if(mouseY>250 && mouseY<265){//[V] if(this.alarmMinute > 0){ this.alarmMinute -= 1; }else{ this.alarmMinute = 59; } this.isAlarmSet = true; delay(100); } } } //[STOP] stroke(255); fill(255); rect(460,95,100,45); stroke(0); fill(0); textSize(38); text("Stop",470,130); if(mousePressed){ if(mouseX>460 && mouseX<560 && mouseY>95 && mouseY<140){ this.isAlarmSet = false; song.close(); song = minim.loadFile("GET UP - Sergej Smile.mp3"); } } //clock int lenge = 200; int MARGIN = 20; //点の描画 translate(lenge, lenge); rotate(radians(180)); pushMatrix(); strokeWeight(0); fill(128); for(int i=0; i<60; i++){ rotate(radians(6)); ellipse(lenge-MARGIN,0,3,3); } for(int i=0; i<12; i++){ rotate(radians(30)); ellipse(lenge-MARGIN,0,10,10); } //針の描画 popMatrix(); stroke(255); pushMatrix(); rotate(radians(s*(360/60))); strokeWeight(1); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(m*(360/60))); strokeWeight(2); line(0,0,0,lenge-MARGIN); popMatrix(); pushMatrix(); rotate(radians(h*(360/12))); strokeWeight(4); line(0,0,0,(lenge*3)/4-MARGIN); popMatrix(); } }
テキスト整形のルールを表示する
添付ファイル:
写真 1.JPG
3件
[
詳細
]