View
Theme
Font Style
7pt
8pt
9pt
10pt
11pt
Line Style
100%
110%
120%
130%
140%
Bold Keyword
Default
Inspector
Kkaefer
Eclipse
SQ Light
Lesser
Dark
Cobalt
Monokai
Rubyblue
Night
SQ Dark
Ambiance
Blackboard
Line Num.
Wrap Lines
Preview
Redraw
JS Tab
HTML Tab
CSS Tab
Live Tab
Prev. Tab
Next Tab
Browser
History…
Help
Edit
Settings
Auto Complete
Match Brackets
Match Highlight
Strip Whitespace
Auto Close Brackets
Auto Close Quotes
Show Print Margin
Undo
Redo
Delete
Select Line
Select All
Find & Replace
Find
Find in Repo.
Find Next
Find Previous
Replace Single
Replace All
Wrap Search
Revert
As Template
Diff Revision
Format
Compress
Text
Zen Coding
Indent
Tab Width
1
2
3
4
5
6
7
8
Indent Unit
1
2
3
4
5
6
7
8
Smart Indent
Use Tabs
Visible Tabs
Shift Left
Shift Right
Put Indent
Number
Increment by 1
Decrement by 1
Increment by 0.1
Decrement by 0.1
Increment by 10
Decrement by 10
Simple Math
Comment
Line
Move Up
Move Down
Copy Up
Copy Down
Go to Line…
Remove Line
Next Point
Prev. Point
Help
Share
Login
You can jump to the latest bin by adding
/latest
to your URL
×
z
Find
→
←
⟲
Replace
⊗
All
Replace
var canvas = document.getElementById('world'); var windowSize_x = 465; var windowSize_y = 465; var N_SAKURA = 100; var wind_x=0; var sakuraAry= new Array(N_SAKURA); var ctx; var fallNumber=0; window.onload=function(){ init(); setInterval("update()",30); }; //桜の初期位置をセット function init(){ windowSize_x = window.innerWidth; windowSize_y = window.innerHeight; for(i=0;i
0.35){ for(j=0;j<10;j++){ ctx.beginPath(); ctx.arc(this.x, this.y, 30*this.size-j,-2*Math.PI,0, false); ctx.fillStyle = "rgba(255,255,255, 0.05)"; ctx.fill(); } } //桜が徐々に消えていく表現 if(this.isWave === true){ ctx.beginPath(); setFillStyle(ctx,this.countWave); ctx.arc(this.x, this.y, 30*this.size,-2*Math.PI,0, false); ctx.fill(); } ctx.translate(this.x,this.y); ctx.scale(1/Math.cos(this.axis_y),1/Math.cos(this.axis_z)); ctx.rotate(-this.axis_x); ctx.translate(-this.x,-this.y); //水面の波紋の表現部分 if(this.isWave === true){ ctx.translate(this.x,this.y); ctx.scale(1,0.5); ctx.translate(-this.x,-this.y); ctx.beginPath(); setStrokeStyle(ctx,this.countWave); ctx.arc(this.waveCenter_x,this.waveCenter_y,this.countWave*this.size*2,Math.PI*2,false); ctx.stroke(); ctx.translate(this.x,this.y); ctx.scale(1.0,2.0); ctx.translate(-this.x,-this.y); } }; sakura.prototype.fall = function(){ if(this.isWave === false){ this.x += wind_x*this.size; this.y += 5*this.size;// this.axis_x += this.axisV_x; this.axis_y += this.axisV_y; this.drawNumberIndicator = this.size + fallNumber + N_SAKURA; //this.axis_z += this.axisV_z; //桜の角度によって一瞬消失する点を回避 if(Math.abs(Math.cos(this.axis_y))<0.1){ if(this.axisV_y<0){ this.axis_y -= 0.2; } else{ this.axis_y += 0.2; } } if(this.y>windowSize_y*Math.sqrt(this.size)*1.2){ this.isWave=true; this.waveCenter_x = this.x; this.waveCenter_y = this.y; fallNumber++; this.drawNumberIndicator = fallNumber; } if(this.x< -20){ this.x += (windowSize_x+20); } else if(this.x>windowSize_x + 20){ this.x -= (windowSize_x+20); } } else if(this.isWave === true){ this.countWave += 1; this.axis_y = 0.5; this.y += (this.countWave)/60*this.size; if(this.countWave>waveDeadLimit){ this.countWave = 0; this.isWave = false; this.x = windowSize_x*Math.random(); this.y = 0; this.size = (Math.random()+Math.random())/2; } } }; function aryCheck(){ if(fallNumber > 1000){ fallNumber -= 1000; for(h=0;h
sakuraAry[h+1].drawNumberIndicator){ aryInsert(h+1); h=0; } } } function aryInsert(a){ var insertNumber=0; for(j=0;j
= windUpdateLimit){//countWUはwindUpdateで更新される this.nextAxisV_x = Math.random()*Math.PI*0.05; this.nextAxisV_y = Math.random()*Math.PI*0.05; //this.nextAxisV_z = 0;//Math.random()*Math.PI*0.05; } if(countWU < windUpdateLimit){ this.axisV_x += (this.nextAxisV_x-this.axisV_x)/(windUpdateLimit-countWU); this.axisV_y += (this.nextAxisV_y-this.axisV_y)/(windUpdateLimit-countWU); //this.axisV_z += (this.nextAxisV_z-this.axisV_z)/(50-countWU); } }; var countWU = 0; var nextWindGoal = 0; var windUpdateLimit = 50; //風力・風向の更新 function windUpdate(){ if(countWU >= windUpdateLimit){ countWU = 0; nextWindGoal = (Math.random()+Math.random()+Math.random()-1)*10; //正規分布の乱数生成 } wind_x += (nextWindGoal-wind_x)/(windUpdateLimit-countWU); countWU++; } var waveDeadLimit = 60; function setFillStyle(ctx,n){ var transpalent = n/waveDeadLimit; var color = "rgba(0,0,0," + transpalent + ")"; ctx.fillStyle = color; } function setStrokeStyle(ctx,n){ var transpalent = 1-n/waveDeadLimit; if(transpalent<0){ transpalent = 0; } var color = "rgba(255,255,255," + transpalent + ")"; ctx.strokeStyle = color; }
水面へ落ちる桜
* { margin:0;padding:0;background-color:black; }
Pop out
Help
About
×
×