You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
893 B
HTML
46 lines
893 B
HTML
<!DOCTYPE html>
|
|
<head>
|
|
<script src="p5.min.js" ></script>
|
|
<script>
|
|
console.log("hey there");
|
|
function preload(){
|
|
img=loadImage('wheel.png')
|
|
}
|
|
function setup() {
|
|
createCanvas(windowWidth, windowHeight);
|
|
button = createButton("spin the wheel!");
|
|
button.position(windowWidth/2-250, windowHeight/2);
|
|
button.mousePressed(spin);
|
|
}
|
|
|
|
var spinning = 1;
|
|
var currentSpinning = 0;
|
|
function spin(){
|
|
spinning = 1800 + random(0,500);
|
|
currentSpinning = 0;
|
|
}
|
|
|
|
function card(){
|
|
rect(0, 0, 55, 55);
|
|
console.log("hey pop up here");
|
|
}
|
|
function draw() {
|
|
background(220);
|
|
imageMode(CENTER);
|
|
angleMode(DEGREES);
|
|
translate (windowWidth/2, windowHeight/2);
|
|
rotate(currentSpinning);
|
|
image (img,0,0,200,200);
|
|
currentSpinning = currentSpinning+10;
|
|
if (currentSpinning > spinning){
|
|
currentSpinning = spinning;
|
|
card();
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
</body> |