Sexual Ecologies Diagram
by jude_pinto
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.6/interact.min.js"></script>
<button id= "button_E">Reset
</button>
<span class="heading"> Gender/Sex Eroticism </span>
<svg id = "container_1" class = "resize-container_E" >
<foreignobject>
<div id="Porn_E" class="resize-drag" >
<svg class = "move" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="100" y="200"
width="511.626px" height="511.626px" viewBox="0 0 511.626 511.626" style="enable-background:new 0 0 511.626 511.626;"
xml:space="preserve">
<g>
<path...
CSS
.resize-drag {
/* shape parameters */
border-radius: 50%;
width: 212px;
height: 212px;
min-height: 1px;
min-width: 1px;
max-height: 300px;
max-width: 300px;
padding: 0px 0px 0px 0px;
margin: 90px 90px 90px 250px;
align-items: center;
/* positioning */
position: relative;
/* text location */
display: flex;
justify-content: center;
box-sizing: border-box;
/* font */
color: black;
font-family: sans-serif;
font-size: 18px;
user-select: none;
touch-action: none;
}
.resize-container_E {
width: 950px;
height: 600px;
border-style: solid;
text-align: center;
position: relative;
align-items: center;
margin: 0 auto;
}
#button_E {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: block;
font-size: 16px;
position: relative;
margin-left: 238px;
}
#submit_button {
border-radius: 10%;
background-color: #BD1414; /* Red */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: block;
font-size: 16px;
position: relative;
margin: 20px 510px 100px;
}
.heading {
color: black;
font-family: sans-serif;
font-size: 22px;
}
#Porn_E{
background-color: rgba(35, 179, 241,.55);
left: 122px;
top:-10px;
position: absolute;
mix-blend-mode: multiply;
}
#Porn_E span#Porn_Ea {
display: inline;
}
#Porn_E:hover span#Porn_Ea {
display: none;
}
#Porn_E span#Porn_Eb {
display: none;
}
#Porn_E:hover span#Porn_Eb {
display: inline;
}
#Fantasy_E {
background-color:rgba(241, 234, 34,.55);
top: 200px;
left: -30px;
position: absolute;
mix-blend-mode: multiply;
}
#Fantasy_E span#Fantasy_Ea {
display: inline;
}
#Fantasy_E:hover span#Fantasy_Ea {
display: none;
}
#Fantasy_E span#Fantasy_Eb {
display: none;
}
#Fantasy_E:hover span#Fantasy_Eb {
display: inline;
}
#In_Person_E {
...
JavaScript
// Sexual Ecologies Diagram Code
//By: Jude Pinto
//535 lines of code.
// This code was implemented into a survey on Qualtrics for Aki Gormezano's study on Sexual Ecologies.
//This program has imported the library interact.js, created by Taye.
//https://interactjs.io/
//Instructions: Drag and resize any circle using a mouse or touch screen.
//To reset circle positions, press "Reset". To obtain the areas of the circles, areas of intersection, radii, and coordinates, click "Submit".
//---------------------------------------------------------------------------------
//Global Variables
//Usually, global variables are not ideal, however, I implemented them to make the program more legible to those conducting the study.
//Variables contain the initial radius and coordinate values of each circle when the program starts.
//PornE Global Start Values
var Porn_E_radius = document.getElementById("Porn_E").clientWidth/2;
var Porn_E_start = findCentroid(getPos1(Porn_E), getPos2(Porn_E));
var Porn_E_startx= Porn_E_start.x2;
var Porn_E_starty= Porn_E_start.y2;
//FantasyE Global Start Values
var Fantasy_E_radius = document.getElementById("Fantasy_E").clientWidth/2;
var Fantasy_E_start = findCentroid(getPos1(Fantasy_E), getPos2(Fantasy_E));
var Fantasy_E_startx= Fantasy_E_start.x2;
var Fantasy_E_starty= Fantasy_E_start.y2;
//InPersonE Global Start Values
var In_Person_E_radius = document.getElementById("In_Person_E").clientWidth/2;
var In_Person_E_start = findCentroid(getPos1(In_Person_E), getPos2(In_Person_E));
var In_Person_E_startx= In_Person_E_start.x2;
var In_Person_E_starty= In_Person_E_start.y2;
//Global Coordinate Dictionaries
//Contain the x and y coordinates of each circle
var CoordinatesX_E = {
Porn_E: Porn_E_startx,
Fantasy_E: Fantasy_E_startx,
In_Person_E: In_Person_E_startx
};
var CoordinatesY_E = {
Porn_E: Porn_E_starty,
Fantasy_E: Fantasy_E_starty,
In_Person_E: In_Person_E_starty
};
//Global Intersection...