forked from hidcCombEx/SpedUp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch.js
74 lines (62 loc) · 1.7 KB
/
sketch.js
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
let button = [], click = 0
function preload() {
yy = loadImage('logo/yawayats.svg')
osl = loadImage('logo/osl.svg')
jt = loadImage('logo/jtypo.svg')
pf = loadImage('logo/pf.svg')
vv = loadImage('logo/vivid.svg')
}
function setup() {
canvas = createCanvas(windowWidth, windowHeight * 0.735)
canvas.parent('sketch')
noStroke()
imageMode(CENTER)
textAlign(CENTER, CENTER)
setButton()
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight * 0.75)
clear()
setButton()
}
function draw() {
cursor(ARROW)
if (click > 0) click -= 0.5
button.forEach (p => p.display())
}
function setButton() {
button = []
button.push(new Crew('yawayats', yy))
button.push(new Crew('opensourcelab', osl))
button.push(new Crew('jochiwontypography', jt))
button.push(new Crew('primeframevivid', pf))
button.push(new Crew('primeframevivid', vv))
}
function mouseReleased() {
click = 1
}
class Crew {
constructor(club, img) {
this.x = random(width * 0.2, width * 0.8)
this.y = random(height * 0.3, height * 0.8)
this.r = random(50, 240)
this.a = random(TAU)
this.club = club
this.img = img
}
display() {
if (dist(mouseX, mouseY, this.x, this.y) < this.r / 2) {
if (click) location.href=`${this.club}.html#archive`
cursor(HAND)
}
push()
translate(this.x, this.y)
rotate(this.a)
fill(242)
stroke(86)
strokeWeight(3)
circle(0, 0, this.r)
image(this.img, 0, 0, this.r, this.r * 0.75)
pop()
}
}