2016-09-18 23:50:50 +00:00
|
|
|
|
<?php
|
|
|
|
|
require __DIR__ . '/../bootstrap.php';
|
|
|
|
|
error_reporting(E_ALL);ini_set('display_errors', true);
|
|
|
|
|
|
|
|
|
|
$em = \EmotionHero\Application::getInstance()->getEm();
|
|
|
|
|
/* @var $hitRepo EmotionHero\Models\HitRepository */
|
|
|
|
|
$hitRepo = $em->getRepository(\EmotionHero\Models\Hit::class);
|
|
|
|
|
|
|
|
|
|
/* @var $currentHit \EmotionHero\Models\Hit */
|
|
|
|
|
$currentHit = $hitRepo->findOneBy(['hasImage'=>true], ['id'=>'DESC']);
|
|
|
|
|
$betterHit = $hitRepo->getBetterHit($currentHit);
|
|
|
|
|
|
|
|
|
|
$printEmoBlocks = function($emotion, $feature, $steps = 6) use($em) {
|
|
|
|
|
foreach(range(0, 100, 100/($steps-1)) as $i) {
|
|
|
|
|
/* @var $hitRepo EmotionHero\Models\HitRepository */
|
|
|
|
|
$hitRepo = $em->getRepository(EmotionHero\Models\Hit::class);
|
2016-09-19 16:25:59 +00:00
|
|
|
|
// if($feature == 'nose'){
|
|
|
|
|
// $items = [992, 1035, 701, 888, 671, 906, 693, 725, 762, 666, 751,992,728];
|
|
|
|
|
// $hit = $hitRepo->find($items[array_rand($items)]);
|
|
|
|
|
// } elseif($feature == 'mouth_left') {
|
|
|
|
|
// $items = [992, 1035, 1034, 888];
|
|
|
|
|
// $hit = $hitRepo->find($items[array_rand($items)]);
|
|
|
|
|
// } else{
|
2016-09-18 23:50:50 +00:00
|
|
|
|
$hit = $hitRepo->getClosestHitWithImage($emotion, $i);
|
2016-09-19 16:25:59 +00:00
|
|
|
|
// }
|
2016-09-18 23:50:50 +00:00
|
|
|
|
$img = $hit->getFeatureImgAsString($feature);
|
|
|
|
|
$score = $hit->getEmotions()->getEmotionScore($emotion);
|
|
|
|
|
|
|
|
|
|
$percentage = sprintf("%.0f %%",$score);
|
|
|
|
|
echo <<< EOSNIPPET
|
|
|
|
|
<div class="block">
|
|
|
|
|
<img src="data:image/x-icon;base64,$img" title="{$hit->getId()}">
|
|
|
|
|
|
|
|
|
|
<span class="perc">$percentage</span>
|
|
|
|
|
</div>
|
|
|
|
|
EOSNIPPET;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<title>Emotion Hero</title>
|
|
|
|
|
</head>
|
|
|
|
|
<style type="text/css">
|
2016-09-20 09:27:36 +00:00
|
|
|
|
html{
|
|
|
|
|
height:100%;
|
|
|
|
|
overflow:hidden;
|
|
|
|
|
}
|
|
|
|
|
body{
|
|
|
|
|
background:blue;
|
|
|
|
|
font-family:"Unifont";
|
|
|
|
|
font-weight:bold;
|
|
|
|
|
font-size:1vw;
|
|
|
|
|
margin:0.5em;
|
|
|
|
|
}
|
|
|
|
|
body.presentation{
|
|
|
|
|
background:black;
|
|
|
|
|
}
|
2016-09-18 23:50:50 +00:00
|
|
|
|
h3{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
margin:0.5%;
|
|
|
|
|
text-align:center;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
2016-09-20 09:27:36 +00:00
|
|
|
|
h3 span{
|
|
|
|
|
background:black;
|
|
|
|
|
color:white;
|
|
|
|
|
padding:0.2%;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.block{
|
|
|
|
|
width:100%;
|
|
|
|
|
font-size:80%;
|
|
|
|
|
}
|
2016-09-18 23:50:50 +00:00
|
|
|
|
.mouth .emo-block{
|
|
|
|
|
width:50%;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
float:left;
|
|
|
|
|
height:5em;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.mouth .emotitle{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
display:block;
|
|
|
|
|
width:14%;
|
|
|
|
|
margin-right:0.14%;
|
|
|
|
|
margin-left:0.14%;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
float:left;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
font-size:80%;
|
|
|
|
|
padding-top:2.5%
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.mouth .block {
|
2016-09-20 09:27:36 +00:00
|
|
|
|
width:14%;
|
|
|
|
|
margin-right:0.14%;
|
|
|
|
|
margin-left:0.14%;
|
|
|
|
|
float:left;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*.emotitle span:before{content:"‹";}
|
|
|
|
|
.emotitle span:after{content:"›";}*/
|
|
|
|
|
.emotitle{font-style:italic;}
|
|
|
|
|
.emotitle:before{content:"«";}
|
|
|
|
|
.emotitle:after{content:"»";}
|
|
|
|
|
|
2016-09-20 09:27:36 +00:00
|
|
|
|
img{
|
|
|
|
|
width:100%;
|
|
|
|
|
filter:saturate(0%);
|
|
|
|
|
mix-blend-mode: multiply;
|
|
|
|
|
/*mix-blend-mode: exclusion;*/
|
|
|
|
|
}
|
2016-09-18 23:50:50 +00:00
|
|
|
|
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.perc{
|
|
|
|
|
display:block;
|
|
|
|
|
width:100%;
|
|
|
|
|
text-align:center;
|
|
|
|
|
}
|
2016-09-18 23:50:50 +00:00
|
|
|
|
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.emo-block{
|
2016-09-18 23:50:50 +00:00
|
|
|
|
float:left;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
text-align:center;
|
|
|
|
|
}
|
|
|
|
|
.brows .emo-block {
|
|
|
|
|
width:23%;
|
|
|
|
|
margin-left:1%;
|
|
|
|
|
margin-right:1%;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.nose .emo-block {
|
|
|
|
|
width:12%;
|
|
|
|
|
margin-left:1.14%;
|
|
|
|
|
margin-right:1.14%;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.nose .emotitle{
|
|
|
|
|
font-size:80%;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.emo-block-emos{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
position:relative;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.emo{
|
2016-09-18 23:50:50 +00:00
|
|
|
|
text-align:center;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
float:left;
|
|
|
|
|
background:#fff;
|
|
|
|
|
}
|
|
|
|
|
.brows{
|
|
|
|
|
width:40%;
|
|
|
|
|
margin-right:1%;
|
|
|
|
|
}
|
|
|
|
|
.nose{
|
|
|
|
|
width:40%;
|
|
|
|
|
margin-right:1%;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.mouth{
|
|
|
|
|
width:81%;
|
|
|
|
|
margin-top:1%;
|
|
|
|
|
}
|
|
|
|
|
img.curImg{
|
2016-09-18 23:50:50 +00:00
|
|
|
|
position:absolute;
|
|
|
|
|
left:0;
|
|
|
|
|
mix-blend-mode:difference;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.currentHit svg{
|
|
|
|
|
border-top: 1em solid blue;
|
|
|
|
|
margin: 0px -0.5em;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 0.5em;
|
|
|
|
|
width:100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.presentation .currentHit svg {
|
|
|
|
|
border-top: solid 0.1em white;
|
|
|
|
|
}
|
2016-09-18 23:50:50 +00:00
|
|
|
|
|
|
|
|
|
.nose .block{position:relative;margin-bottom:2%;}
|
|
|
|
|
.nose .block span{position:absolute;top:0;right:0;color:white;text-align:right;padding:0.5%;}
|
2016-09-19 09:36:04 +00:00
|
|
|
|
|
2016-09-19 12:58:58 +00:00
|
|
|
|
.brows .emo-block.brow_explainer {
|
2016-09-20 09:27:36 +00:00
|
|
|
|
margin-top:3%;font-size:85%;
|
|
|
|
|
border-left: 0.3em solid blue;
|
|
|
|
|
width: 22%;
|
|
|
|
|
padding-left: 0.4em;
|
|
|
|
|
margin-left: -0.1em;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
2016-09-20 09:31:59 +00:00
|
|
|
|
.presentation .brows .emo-block.brow_explainer{
|
|
|
|
|
border-left-color: black;
|
|
|
|
|
}
|
2016-09-18 23:50:50 +00:00
|
|
|
|
.brow_explainer img{filter:unset;margin-bottom:5%;}
|
|
|
|
|
.brow_explainer ol{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
margin:0;padding:0;
|
|
|
|
|
counter-reset:li 4;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
.brow_explainer li{
|
|
|
|
|
text-align:left;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
margin-bottom:5%;
|
|
|
|
|
list-style:none;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.brow_explainer li:before{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
content:counter(li) ". "; /* Use the counter as content */
|
|
|
|
|
counter-increment:li; /* Increment the counter by 1 */
|
|
|
|
|
color:red;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.currentHit{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
width:17%;
|
|
|
|
|
position:absolute;
|
|
|
|
|
right:0.5em;
|
|
|
|
|
top:0.5em;
|
|
|
|
|
background:yellow;
|
|
|
|
|
padding:0.5%;
|
|
|
|
|
}
|
2016-09-20 09:29:33 +00:00
|
|
|
|
.presentation .currentHit {
|
|
|
|
|
background:none;
|
2016-09-20 09:29:56 +00:00
|
|
|
|
color:white;
|
2016-09-20 09:29:33 +00:00
|
|
|
|
}
|
2016-09-20 09:27:36 +00:00
|
|
|
|
.presentation .currentHit h3 span{
|
|
|
|
|
color:white;
|
|
|
|
|
background: none;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.currentHit h3 span{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
color:yellow;
|
|
|
|
|
}
|
|
|
|
|
.presentation .currentHit h3 span{
|
|
|
|
|
color:white;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
2016-09-19 00:08:28 +00:00
|
|
|
|
.currentHit h3 .last{color:red;}
|
|
|
|
|
.currentHit h3 .vs{background:none;color:black;padding-left:0.5em;padding-right:0.5em;}
|
|
|
|
|
.currentHit h3 .perfect{}
|
2016-09-18 23:50:50 +00:00
|
|
|
|
|
|
|
|
|
ul{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
font-size:80%;
|
|
|
|
|
list-style:none;
|
|
|
|
|
margin:0;
|
|
|
|
|
padding:0;
|
|
|
|
|
}
|
|
|
|
|
.presentation ul{
|
2016-09-20 09:31:22 +00:00
|
|
|
|
font-size:1.1em;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.currentHit li{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
clear:both;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.currentHit li .value{
|
|
|
|
|
float:right;
|
|
|
|
|
}
|
|
|
|
|
.currentHit li .diff{
|
|
|
|
|
float:right;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
clear:both;
|
|
|
|
|
font-size:72%;
|
|
|
|
|
color:gray;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
.currentHit li .diff.negative{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
color:red;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.currentHit li .diff.positive{
|
2016-09-20 09:27:36 +00:00
|
|
|
|
color:green;
|
2016-09-19 00:08:28 +00:00
|
|
|
|
}
|
2016-09-20 09:33:01 +00:00
|
|
|
|
.presentation .currentHit li .diff.positive{
|
|
|
|
|
color:yellow;
|
|
|
|
|
}
|
2016-09-19 00:08:28 +00:00
|
|
|
|
.currentHit p {
|
|
|
|
|
margin: 0 -0.5em 1% -0.5em;
|
2016-09-20 09:27:36 +00:00
|
|
|
|
border-bottom: solid 1em blue;
|
|
|
|
|
padding: 0.5em;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.presentation .currentHit p {
|
|
|
|
|
border-bottom: solid 0.1em white;
|
2016-09-18 23:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
</style>
|
2016-09-20 09:27:36 +00:00
|
|
|
|
<body <?php if(isSet($_GET['presentation'])){echo "class='presentation'";}?>>
|
2016-09-18 23:50:50 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
echo "<div class='brows emo'><h3><span>eye brows</span></h3>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) {
|
|
|
|
|
echo "<div class='emo-block'><span class='emotitle'>$emotion</span><div class='emo-block-emos'>";
|
|
|
|
|
$printEmoBlocks($emotion, 'brows');
|
|
|
|
|
//echo "<img class='curImg' src=\"data:image/x-icon;base64,{$currentHit->getFeatureImgAsString("brows")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getEmotionScore($emotion)}%\">";
|
|
|
|
|
echo "</div></div>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<div class="emo-block brow_explainer">
|
|
|
|
|
<img src="brow_explain.png">
|
|
|
|
|
<ol start="5">
|
|
|
|
|
<li>Outer Right Brow Corner</li>
|
|
|
|
|
<li>Right Brow Center</li>
|
|
|
|
|
<li>Inner Right Brow Corner</li>
|
|
|
|
|
<li>Inner Left Brow Corner</li>
|
|
|
|
|
<li>Left Brow Center</li>
|
|
|
|
|
<li>Outer Left Brow Corner</li>
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
echo "</div>"; // .brows
|
|
|
|
|
|
|
|
|
|
echo "<div class='nose emo'><h3><span>nose</span></h3>";
|
|
|
|
|
foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) {
|
|
|
|
|
echo "<div class='emo-block'><span class='emotitle'>$emotion</span><div class='emo-block-emos'>";
|
|
|
|
|
$printEmoBlocks($emotion, 'nose');
|
|
|
|
|
//echo "<img class='curImg' src=\"data:image/x-icon;base64,{$currentHit->getFeatureImgAsString("nose")}\" title=\"{$currentHit->getId()}\" style=\"top:{$currentHit->getEmotions()->getEmotionScore($emotion)}%\">";
|
|
|
|
|
echo "</div></div>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "</div>"; // .nose
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "<div class='mouth emo'><h3><span>mouth</span></h3>";
|
|
|
|
|
foreach(EmotionHero\Models\Emotions::$EMOTIONS as $emotion) {
|
|
|
|
|
echo "<div class='emo-block'><span class='emotitle'>$emotion</span><div class='emo-block-emos'>";
|
|
|
|
|
$printEmoBlocks($emotion, 'mouth_left');
|
|
|
|
|
echo "</div></div>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "</div>"; // .mouth
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "<div class='currentHit'>";
|
2016-09-19 00:08:28 +00:00
|
|
|
|
echo "<h3><span class='last'>last</span><span class='vs'>vs</span><span class='perfect'>perfect</span></h3>";
|
|
|
|
|
// echo "<p>".\PrettyDateTime\PrettyDateTime::parse($currentHit->getGame()->getOriginalGameAt())."</p>";
|
2016-09-18 23:50:50 +00:00
|
|
|
|
echo "<p>aim: {$currentHit->getTarget()->getScore()}% ".$currentHit->getTarget()->getEmotion()->getName()."</p>";
|
|
|
|
|
echo "<ul>";
|
|
|
|
|
$expressions = array_keys($currentHit->getExpressions()::$EXPRESSIONS_2ND_PERSON);
|
|
|
|
|
sort($expressions);
|
|
|
|
|
foreach($expressions as $expression) {
|
|
|
|
|
$currentScore = $currentHit->getExpressions()->getExpressionScore($expression);
|
|
|
|
|
$betterScore = $betterHit->getExpressions()->getExpressionScore($expression);
|
|
|
|
|
$diff = $betterScore - $currentScore;
|
|
|
|
|
if($diff > 0) {
|
|
|
|
|
$diffclass = "positive";
|
|
|
|
|
}elseif($diff < 0) {
|
|
|
|
|
$diffclass = "negative";
|
|
|
|
|
}
|
|
|
|
|
echo "<li>";
|
|
|
|
|
echo "<span class='name'>$expression</span>";
|
|
|
|
|
echo "<span class='value'>". sprintf("%.5f", $currentScore)." %</span>";
|
|
|
|
|
echo "<span class='diff $diffclass'>". sprintf("%+.5f", $diff)." %</span>";
|
|
|
|
|
echo "</li>";
|
|
|
|
|
}
|
|
|
|
|
echo "</ul>";
|
|
|
|
|
|
|
|
|
|
$circles = "";
|
|
|
|
|
foreach($betterHit->getPoints()->getNormalisedPoints() as $i => $point) {
|
|
|
|
|
/* $circles .= '<circle
|
|
|
|
|
style="fill:gray;"
|
|
|
|
|
id="point'.$i.'"
|
|
|
|
|
cx="'.$point->getX().'"
|
|
|
|
|
cy="'.$point->getY().'"
|
|
|
|
|
r="0.7" />';*/
|
|
|
|
|
$circles .= '<text
|
|
|
|
|
style="fill:green;font-size:4"
|
|
|
|
|
id="point'.$i.'"
|
|
|
|
|
x="'.$point->getX().'"
|
|
|
|
|
y="'.$point->getY().'"
|
|
|
|
|
r="0.7">'.$i.'</text>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach($currentHit->getPoints()->getNormalisedPoints() as $i => $point) {
|
|
|
|
|
$circles .= '<text
|
|
|
|
|
style="fill:red;font-size:4"
|
|
|
|
|
id="point'.$i.'"
|
|
|
|
|
x="'.$point->getX().'"
|
|
|
|
|
y="'.$point->getY().'"
|
|
|
|
|
r="0.7">'.$i.'</text>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo <<< EOSVG
|
|
|
|
|
<svg
|
|
|
|
|
xmlns:svg="http://www.w3.org/2000/svg"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
viewBox="-4 -4 108 108"
|
|
|
|
|
id="svg2"
|
|
|
|
|
version="1.1">
|
|
|
|
|
<g id="layer1">
|
|
|
|
|
$circles
|
|
|
|
|
</g>
|
|
|
|
|
</svg>
|
|
|
|
|
EOSVG;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "</div>"; // .currentHit
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|