xxxxxxxxxx
91
const snowflakeCount = 100;
const colour = "#FFFFFF"
const width = 750
const height = 750
const base = width * 0.75
const textContent = "Happy Holidays!"
function preload() {
//shiffman = loadImage("Dan_grinning.png")
equal = loadImage("Equal_smile.png")
//rainbow = loadImage("Rainbow_zany.png")
thisdot = loadImage("ThisDot_smile.png")
squares = loadImage("Square_smile.png")
asterisk = loadImage("Asterisk_smile.png")
}
const create_snowflake = (c) => new Snowflake(
{
x: width/2,
y: height/1.5 - 25
},
base/2,
1.5,
c
)
let snowflakes = []
function setup() {
createCanvas( width, height );
frameRate(80);
for(let i = 0; i < snowflakeCount; i++){
snowflakes.push(create_snowflake(colour))
}
}
function drawCharacters(){
xBase = width/2 - base/2
yBase = height/1.5 - 60
//image(shiffman,xBase+150,yBase,width/20, height/20)
image(equal,xBase+150,yBase,width/20, height/20)
//image(rainbow,xBase+75,yBase,width/20, height/20)
image(thisdot,xBase+225,yBase,width/20, height/20)
image(squares,xBase+300,yBase,width/20, height/20)
image(asterisk,xBase+375,yBase,width/20, height/20)
}
function drawGlobeBase(){
// Create globe base
fill("f")
stroke("f")
rect(
width/2 - base/2, // x
height/1.5 - 25, // y
base, // width
50 // height
)
}
function drawGlobeGlass(){
// Create globe container
noFill()
arc(
width/2, // x
height/1.5 - 25, // y
base, // width
height/1.25, // height
PI, // start
0 // stop
)
}
function letItSnow(){
snowflakes.forEach( flake => flake.drawSnowflake() )
}
function draw() {
background( 51 );
drawGlobeBase();
drawGlobeGlass();
letItSnow();
drawCharacters();
textSize(80);
fill(100)
text(textContent, width/8, height/1.2);
}
function mousePressed() {
saveGif("holiday.gif",5);
}