xxxxxxxxxx
101
let font;
let blockWall;
let coffee;
let offset = 0.0;
function preload(){
// font = loadFont('assets/AlexBrush-Regular.ttf');
// // font = loadFont('assets/TextMeOne-Regular.ttf');
// blockWall = loadImage('assets/blockWall.png');
// coffee = loadImage('assets/coffee.png');
}
function setup(){
createCanvas(960, 540);
colorMode(HSB, 360, 100, 100, 100);
fill(255);
// noFill();
stroke(255);
strokeWeight(1);
// textFont(font);
textAlign(CENTER, CENTER);
textSize(24);
rotate(PI / 3.0);
imageMode(CENTER);
pixelDensity(5);//High reso, slows frame rate
}
function draw(){
background(0);
frameRate(24);
// image(blockWall, width/2, height/2);
for (let i = 0; i < 9; i++) {
textNeon(
'Το μαγνητικό πεδίο του πλανήτη μας σχηματίζεται',
width/2,
height/2,
color(332, 58, 91, 100)
);
}
textNeon(
'Το μαγνητικό πεδίο του πλανήτη μας σχηματίζεται',
width/2,
height/2,
color(332, 58, 91, 100)
);
imageNeon(
coffee,
width*3/4,
height/2-60,
120, 100,
color(27, 42, 97, 100)
);
}
function textNeon(glowText, x, y, glowColor){
glow(glowColor, 400);
text(glowText, x, y);
text(glowText, x, y);
text(glowText, x, y);
glow(glowColor, 80);
text(glowText, x, y);
text(glowText, x, y);
glow(glowColor, 12);
text(glowText, x, y);
text(glowText, x, y);
text(glowText, x, y);
}
function imageNeon(glowImage, x, y, width, height, glowColor){
tint(0, 0, 40, 100);
glow(glowColor, 0);
image(glowImage, x, y, width, height);
tint(0, 0, 100, flickering());
glow(glowColor, 160);
image(glowImage, x, y, width, height);
glow(glowColor, 80);
image(glowImage, x, y, width, height);
image(glowImage, x, y, width, height);
glow(glowColor, 12);
image(glowImage, x, y, width, height);
image(glowImage, x, y, width, height);
tint(0, 0, 100, 100);
}
function flickering(){
offset += 0.08;
let n = noise(offset);
if(n < 0.30) return 0;
else return 100;
}
function glow(glowColor, blurriness){
drawingContext.shadowBlur = blurriness;
drawingContext.shadowColor = glowColor;
}