Commit 1e10cb27 authored by romanregouin's avatar romanregouin
Browse files

Merge branch 'AnimationElevator' into MergeCSS+Animation

parents d1aa7380 e73e7c92
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.757250542" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1637907223727722171" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.286540973" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1637907223727722171" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.757250542" name="Debug">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1475399000198820562" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.286540973" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1475399000198820562" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>
2F62501ED4689FB349E356AB974DBE57=27A19688D8FCA27F331360B1EECE8AF0
8DF89ED150041C4CBC7CB9A9CAA90856=27A19688D8FCA27F331360B1EECE8AF0
2F62501ED4689FB349E356AB974DBE57=660202322E05665B281473ACC615FB63
8DF89ED150041C4CBC7CB9A9CAA90856=660202322E05665B281473ACC615FB63
DC22A860405A8BF2F2C095E5B6529F12=550E9617A07E2F5504F54F74A3EB2C09
eclipse.preferences.version=1
This diff is collapsed.
......@@ -55,6 +55,14 @@
.cabin {
max-width: 11.1vh !important;
position: absolute;
}
.containerCabin {
position: absolute;
height: 100%;
width: 10%;
left: 10%;
}
.sideContainerLeft {
......
......@@ -42,6 +42,7 @@
<div class='sketch'>
<div id='cabinButtons'></div>
<div id='cabinSpace'></div>
<table id='sketchTable'></table>
<div id='drcIndicators'></div>
</div>
......
......@@ -151,7 +151,7 @@ function recreateData(floor){
function sensorFloor(floor, currentState,lastState) {
if(currentState==lastState)return;
changeIndicator(floor, currentState, lastState, "indicatorF" + floor);
if(currentState==1)moveCabinToFloor(floor, false);
if(currentState==1)checkAnimationCabin(floor,0);
}
function upSensorFloor(floor, currentState,lastState) {
......@@ -164,12 +164,14 @@ function downSensorFloor(floor, currentState,lastState) {
if(currentState==lastState)return;
if (floor == 0) return;
changeIndicator(floor, currentState,lastState, "indicatorDF" + floor);
if(currentState==1)checkAnimationCabin(floor,-1);
}
function openDoors(floor,currentState,lastState) {
if(currentState==lastState || currentState==0)return;
let door = document.getElementById("imageDoor" + floor);
addImage(door, "DoorOPEN", door.alt + floor, "jpg", door.id);
if(currentState==1)checkAnimationCabin(floor,1);
}
function closeDoors(floor, currentState,lastState) {
......
......@@ -7,7 +7,7 @@ const IMAGES = "images/";
let cabin = {
floor: 0,
bis: false
bis: 0,
};
function addSidesElement() {
......@@ -41,9 +41,6 @@ function addFloor(cabinIsHere, floorNumber, doorState) {
let table = document.getElementById('sketchTable');
let row = document.createElement('tr');
let cabinCell = document.createElement('td');
addCabin(floorNumber, cabinIsHere, cabinCell);
let containerDoorSide = document.createElement('td');
containerDoorSide.classList.add("flexHorizontalContainer");
......@@ -84,10 +81,22 @@ function addFloor(cabinIsHere, floorNumber, doorState) {
containerUserSide.appendChild(bpImage);
containerUserSide.appendChild(indicatorImage);
row.append(cabinCell, containerDoorSide, floorCell, containerUserSide);
row.append(containerDoorSide, floorCell, containerUserSide);
table.appendChild(row);
}
function addCabin(){
let cabinCell = document.getElementById("cabinSpace");
let cabinImage = document.createElement('img');
cabinImage.classList.add("cabin");
addImage(cabinImage, "Cabin", "cabin image", "jpg", "imageCabinFloor");
cabinImage.style.top="76%";
cabinCell.appendChild(cabinImage);
cabinCell.classList.add("containerCabin");
}
function moveCabinToFloor(floor, bis) {
let newFloor;
let currentFloor;
......@@ -105,6 +114,101 @@ function moveCabinToFloor(floor, bis) {
cabin.bis = bis;
}
let minFloorToPixels=76; // in %
let maxFloorToPixels=2; // in %
let keepAnimation=false;
let timeForOneFloor=2; // in s
let fps=60;
function checkAnimationCabin(floor,upDownSensor){
let elevatorCabin=document.getElementById("imageCabinFloor");
let position;
if(floor-cabin.floor>=2 || floor-cabin.floor<=-2){
cabin.floor=floor;
cabin.bis=upDownSensor;
keepAnimation=false;
position=-1/3*upDownSensor;
elevatorCabin.style.top=""+(maxFloorToPixels+(MAX_FLOOR-floor)*(minFloorToPixels-maxFloorToPixels)/MAX_FLOOR+(minFloorToPixels-maxFloorToPixels)/MAX_FLOOR*position)+"%";
}else{
let facteur=cabin.floor-floor;
position = getPosition(facteur,upDownSensor);
if(facteur==0 && position!=0){
if(upDownSensor==0){
facteur=cabin.bis;
}
else facteur= -upDownSensor;
}
cabin.floor=floor;
cabin.bis=upDownSensor;
keepAnimation=true;
animationCabin(facteur,0,position);
}
}
function getPosition(facteur,sensorPos){
let pos=1;
if(sensorPos==0){
if(cabin.bis==-1){
if(facteur!=0){
pos+=-1/3*facteur
}else{
pos=1/3;
}
}else if(cabin.bis==1){
if(facteur!=0){
pos+=1/3*facteur
}else{
pos=1/3;
}
}else if(facteur==0)pos=0;
}else if(sensorPos==1){
if(cabin.bis==-1){
if(facteur!=0){
pos+=-0.66*facteur
}else{
pos=0.66;
}
}else if(cabin.bis==0){
if(facteur!=0){
pos+=-1/3*facteur
}else{
pos=1/3;
}
}else if(facteur==0)pos=0;
}else if(sensorPos==-1) {
if(cabin.bis==1){
if(facteur!=0){
pos+=0.66*facteur
}else{
pos=0.66;
}
}else if(cabin.bis==0){
if(facteur!=0){
pos+=1/3*facteur
}else{
pos=1/3;
}
}else if(facteur==0)pos=0;
}
return pos;
}
function animationCabin(facteur,counterAnimation,position){
if(!keepAnimation || counterAnimation>=fps*timeForOneFloor*position)return;
let elevatorCabin=document.getElementById("imageCabinFloor");
let tmp=""+(Number(elevatorCabin.style.top.replace("%",""))+facteur*((minFloorToPixels-maxFloorToPixels)/MAX_FLOOR)/(fps*timeForOneFloor))+"%";
if(keepAnimation)elevatorCabin.style.top=tmp;
counterAnimation++;
setTimeout(()=> {
animationCabin(facteur,counterAnimation,position);
},1000/fps)
}
function changeImageDoorFloor(floor, state) {
let newFloor = document.getElementById("imageDoorFloor" + floor);
addImage(newFloor, "Door" + state, "image state" + state, "jpg", newFloor.id);
......@@ -124,6 +228,7 @@ function initSketch() {
addFloor(false, i, "CLOSE");
}
addSidesElement();
addCabin()
}
// ext : extension of the image : jpeg
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment