-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
191 lines (173 loc) · 6.37 KB
/
index.html
File metadata and controls
191 lines (173 loc) · 6.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pointillist Landscape - Never Arrive (2K HD)</title>
<style>
* { margin:0; padding:0; box-sizing:border-box; }
body { background:#0a0a1a; overflow:hidden; font-family:'Courier New', monospace; }
canvas { display:block; cursor:crosshair; }
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let width = 1920, height = 1080;
let particles = [];
let walker = { x:0, y:0, targetX:0, targetY:0 };
let animationId;
let isAnimating = true;
let time = 0;
const palettes = [
['#ff006e', '#8338ec', '#3a86ff', '#06ffa5', '#ffbe0b'],
['#ff006e', '#fb5607', '#ffbe0b', '#8338ec', '#3a86ff'],
['#06ffa5', '#00f5ff', '#0099ff', '#6600ff', '#ff00aa'],
['#ffbe0b', '#ff006e', '#8338ec', '#3a86ff', '#06ffa5'],
];
let currentPalette = palettes[0];
function setResolution(w=1920,h=1080){
const dpr = window.devicePixelRatio || 1;
width = w; height = h;
canvas.width = width*dpr;
canvas.height = height*dpr;
canvas.style.width = width+'px';
canvas.style.height = height+'px';
ctx.setTransform(1,0,0,1,0,0);
ctx.scale(dpr,dpr);
}
function resize(){ setResolution(window.innerWidth, window.innerHeight); }
// ===== original initialization =====
function initParticles(){
particles = [];
const count = Math.floor((width*height)/400);
for(let i=0;i<count;i++){
particles.push({
x: Math.random()*width,
y: Math.random()*height,
size: Math.random()*3+1,
baseSize: Math.random()*3+1,
color: currentPalette[Math.floor(Math.random()*currentPalette.length)],
alpha: Math.random()*0.6+0.2,
layer: Math.random(),
phase: Math.random()*Math.PI*2
});
}
}
function initWalker(){
walker.x = Math.random()*width;
walker.y = Math.random()*height;
walker.targetX = Math.random()*width;
walker.targetY = Math.random()*height;
}
function getLandscapeHeight(x,y){
const scale1 = 0.003, scale2=0.007, scale3=0.015;
let h = Math.sin(x*scale1 + time*0.2)*100 + Math.sin(x*scale2 + y*scale2*0.5)*50 + Math.sin(x*scale3)*25;
const valley = Math.abs(x-width/2)/(width/2);
h -= valley*valley*200;
return height*0.6+h;
}
// ===== original walker draw preserved =====
function drawWalker(){
walker.targetX = width/2 + Math.sin(time*0.3)*(width*0.3);
const groundY = getLandscapeHeight(walker.targetX,0);
walker.targetY = groundY-30;
walker.x += (walker.targetX-walker.x)*0.05;
walker.y += (walker.targetY-walker.y)*0.05;
ctx.globalAlpha=1;
ctx.fillStyle='#ffffff';
ctx.strokeStyle='#ffffff';
ctx.lineWidth=2;
const bounce = Math.abs(Math.sin(time*3))*5;
const wobble = Math.sin(time*2)*2;
ctx.beginPath();
ctx.arc(walker.x, walker.y-25+bounce,6,0,Math.PI*2); ctx.fill();
ctx.beginPath(); ctx.moveTo(walker.x, walker.y-19+bounce); ctx.lineTo(walker.x+wobble, walker.y+bounce); ctx.stroke();
const legSwing = Math.sin(time*4)*10;
ctx.beginPath(); ctx.moveTo(walker.x, walker.y+bounce); ctx.lineTo(walker.x-8+legSwing, walker.y+20+bounce);
ctx.moveTo(walker.x, walker.y+bounce); ctx.lineTo(walker.x+8-legSwing, walker.y+20+bounce); ctx.stroke();
ctx.beginPath(); ctx.moveTo(walker.x, walker.y-10+bounce); ctx.lineTo(walker.x-10-wobble, walker.y+5+bounce);
ctx.moveTo(walker.x, walker.y-10+bounce); ctx.lineTo(walker.x+10+wobble, walker.y+5+bounce); ctx.stroke();
ctx.globalAlpha=0.2;
ctx.beginPath();
ctx.arc(walker.x, walker.y,40,0,Math.PI*2);
ctx.fillStyle='#ffffff';
ctx.fill();
}
function drawStars(){
ctx.globalAlpha=0.8;
ctx.fillStyle='#ffffff';
for(let i=0;i<100;i++){
const x=(i*137.5+time*10)%width;
const y=(i*71.3)%(height*0.4);
const size=Math.random()*1.5;
const twinkle=Math.sin(time*3+i)*0.5+0.5;
ctx.globalAlpha=twinkle*0.8;
ctx.beginPath();
ctx.arc(x,y,size,0,Math.PI*2);
ctx.fill();
}
}
function animate(){
if(!isAnimating) return;
ctx.globalAlpha=0.1;
ctx.fillStyle='#0a0a1a';
ctx.fillRect(0,0,width,height);
time+=0.016;
drawStars();
particles.forEach(p=>{
const landscapeY = getLandscapeHeight(p.x,p.y);
if(p.y>landscapeY){ p.alpha=Math.min(0.8,p.alpha+0.01); p.size=p.baseSize*(1+Math.random()); }
else{ p.alpha=Math.max(0.1,p.alpha-0.005); p.size=p.baseSize*0.5; p.alpha += Math.sin(time*2+p.phase)*0.02; }
p.x += Math.sin(time+p.phase)*0.2; p.y += Math.cos(time*0.5+p.phase)*0.1;
ctx.globalAlpha=Math.max(0,Math.min(1,p.alpha));
ctx.fillStyle=p.color;
ctx.beginPath();
ctx.arc(p.x,p.y,p.size,0,Math.PI*2);
ctx.fill();
});
drawWalker();
animationId=requestAnimationFrame(animate);
}
function generate(){
currentPalette = palettes[Math.floor(Math.random()*palettes.length)];
time=0;
initParticles();
ctx.fillStyle='#0a0a1a';
ctx.globalAlpha=1;
ctx.fillRect(0,0,width,height);
}
function toggleAnimation(){ isAnimating=!isAnimating; if(isAnimating) animate(); }
function saveImage(){ const a=document.createElement('a'); a.download='pointillist-landscape.png'; a.href=canvas.toDataURL(); a.click(); }
// === Automatic HD Recording ===
let recorder; let chunks=[];
function startRecording(durationMs=30000){
try{
const stream=canvas.captureStream(60);
recorder=new MediaRecorder(stream,{mimeType:"video/webm",videoBitsPerSecond:25000000});
recorder.ondataavailable=e=>{if(e.data.size>0) chunks.push(e.data);}
recorder.onstop=()=>{
const blob=new Blob(chunks,{type:"video/webm"});
const url=URL.createObjectURL(blob);
const a=document.createElement('a');
a.href=url; a.download="pointillist_landscape_2k_HD.webm";
a.click();
URL.revokeObjectURL(url);
};
recorder.start();
setTimeout(()=>recorder.stop(),durationMs);
}catch(e){console.warn("Recording not supported.");}
}
// === Initialize ===
setResolution(1920,1080);
initParticles();
initWalker();
animate();
startRecording(30000);
canvas.addEventListener('click',generate);
window.addEventListener('resize',()=>setResolution(window.innerWidth,window.innerHeight));
</script>
</body>
</html>