-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
79 lines (63 loc) · 1.46 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
75
76
77
78
var w = window.innerWidth;
var h = window.innerHeight;
//let img;
function preload() {
//img = loadImage('coco_bg.png');
}
function setup() {
createCanvas(700,700);
Myfont = loadFont('SmileySans-Oblique.otf');
smooth();
}
function draw() {
frameRate(60);
textSize(20);
noStroke();
fill(0);
textFont(Myfont);
text('Gregory Chan Design',530,680)
//fixed type style
noStroke();
fill(30);
textFont(Myfont);
textSize(300);
//image(img, 10, 515);
//img.resize(280, 373);
//if key is pressed it will show text
if (keyCode === LEFT_ARROW) {
text('龍马',30,300);
text('精神',30,600);
} else if(keyCode === UP_ARROW) {
text('齐乐',30,300);
text('龍龍',30,600);
} else if(keyCode === RIGHT_ARROW) {
text('龍光',30,300);
text('焕发',30,600);
}
//background color and transparency
background(255,41,67,20);
textFont('Helvetica');
//type that follow the mouse
textSize(100);
stroke(255);
strokeWeight(1.5);
fill(220,176,100);
text('🐲', mouseX-100, mouseY+50);
//textSize(mouseX*mouseY/500);
}
function mousePressed() {
clear();
background(255,41,67,5);
}
function keyPressed() {
if (key == 's') {
save("mySketch.png");
//saveGif('01.gif', 30, {delay: 0, units : 'frames'});
//saveGif('dragon.gif',5);
}
if (key == 'g') {
//save("mySketch.png");
//saveGif('dragon.gif', 30, {delay: 0, units : 'frames'});
saveGif('dragon.gif',8);
}
}