-
Notifications
You must be signed in to change notification settings - Fork 3
/
2-var.html
33 lines (29 loc) · 1.01 KB
/
2-var.html
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
<!DOCTYPE html><html><head><meta charset="utf-8"/>
<title>websarasa.js</title>
<script src="https://taisukef.github.io/websarasa/websarasa.js"></script>
<script>"use strict";
var main = function(scr) {
scr.loop = function(g, ts, dt, vw) {
// 背景
g.setColor(255, 255, 255); // R, G, B
g.fillRect(0, 0, 1000, 1000); // x, y, width, height
var time = ts % 1000; // ts: ミリ秒単位の時間 → time: ミリ秒
// 赤い丸
g.setColor(255, 0, 0); // R, G, B
g.fillCircle(time, 500, 40); // x, y, r
// 緑の丸
g.setColor(0, 255, 0); // R, G, B
g.fillCircle(530, time, 20); // x, y, r
// 青の四角
var x = 420 + rnd(10); // ランダム 10未満の正数 0-9 を返す
g.setColor(0, 0, 255); // R, G, B
g.fillRect(x, 450, 50, 50); // x, y, w, h
};
};
</script>
</head><body>
<div id=credit>
APP: <a href=http://fukuno.jig.jp/2310>simple</a> CC BY <a href=https://twitter.com/taisukef>@taisukef</a><br>
LIB: <a href=https://taisukef.github.io/websarasa/>websarasa.js</a><br>
</div>
</body>