popup, questions list, random picker

main
Boyana 2 years ago
parent 3483610f1d
commit 1cb5452673

@ -11,25 +11,46 @@
<!--P5.MIN.JS-->
<script src="p5.min.js" ></script>
<script>
console.log("hey there");
var allQuestions=[];
var questions = new XMLHttpRequest();
questions.open('GET', './list.txt');
questions.onreadystatechange = function() {
allQuestions=questions.responseText.split("\n");
}
questions.send();
console.log("hey there");
function preload(){
img=loadImage('wheel.svg')
img=loadImage('wheel.svg');
}
function setup() {
var canvas = createCanvas(windowWidth/2, windowHeight/2);
canvas.parent("wheel");
}
var spinning = 1;
var spinning = 2000;
var currentSpinning = 0;
var spinonoff = false;
function spin(){
spinning = 1800 + random(0,500);
currentSpinning = 0;
spinonoff = true;
}
function card(){
rect(0, 0, 55, 55);
console.log("hey pop up here");
// rect(0, 0, 55, 55);
var popup=document.getElementById("popup");
popup.style.display="block";
var popuptext=document.getElementById("popuptext");
popuptext.innerHTML=allQuestions[Math.floor(Math.random()*allQuestions.length)];
console.log(popup);
currentSpinning = 0;
spinonoff=false;
}
function closepopup(){
var popup=document.getElementById("popup");
popup.style.display="none";
console.log("closing");
}
function draw() {
clear();
@ -37,13 +58,17 @@ function draw() {
imageMode(CENTER);
angleMode(DEGREES);
translate (windowWidth/4, windowHeight/4);
rotate(currentSpinning);
image (img,0,0,250,250);
currentSpinning = currentSpinning+10;
if (currentSpinning > spinning){
currentSpinning = spinning;
card();
if (spinonoff==true){
rotate(currentSpinning);
currentSpinning = currentSpinning+10;
console.log(spinning,currentSpinning);
if (currentSpinning > spinning){
currentSpinning = spinning;
card();
}
}
image (img,0,0,250,250);
}
</script>
</head>
@ -55,6 +80,8 @@ function draw() {
<h2>Welcome, my dear!</h2>>
<p>This exercise you are about to start revolves around healing, in a sense of reconnecting to what is essential and authentic about yourself. As we understand the true nature of our suffering, we can evoke compassion for ourselves as we move through our uncomfortable feelings on the path to healing and peace.
<br>
<br>I will be guiding you through a series of carefully collected questions written by different authors, some well-known and others unknown. You begin the exercise by spinning the Wheel of Fortune. After a few seconds, a question appears on the screen. Then, you take a photo slide from the deck and try to think of an answer to that question by looking at it and the tiny film simultaneously.</p>
</div>
@ -62,15 +89,19 @@ function draw() {
<button class="spin-wheel" onclick="spin()" > Spin</button>
<div id="wheel"></div>
<div id="popup">
<h1 id="popuptext"></h1>
<button class="close" onclick="closepopup()" > Close</button>
</div>
<div class="bg-text-bottom">
<h2>Here are a few things I prepared for you before you begin:</h2>
<p>
<br>1. Have a strong sense of intention to commit to this exercise for some time.
<br>2. Find a quiet room, free of distraction.
<br>3. Get a notebook and a pen. Handwriting will engage your mind more actively and profoundly, help you connect with yourself, and enable the tracing of your progress over time.</p>
<p>1. Have a strong sense of intention to commit to this exercise for some time.
<br>2. Find a quiet room, free of distraction.
<br>3. Get a notebook and a pen. Handwriting will engage your mind more actively and profoundly, help you connect with yourself, and enable the tracing of your progress over time.</p>
</div>
</div>
<img class="top-left-corner" src="crystals.svg">

Loading…
Cancel
Save