Skip to content

Commit

Permalink
added smooth scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
r4nc0r committed May 23, 2017
1 parent ab41f8d commit 15db659
Show file tree
Hide file tree
Showing 23 changed files with 34,565 additions and 878 deletions.
12 changes: 0 additions & 12 deletions .idea/Elonv3.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

744 changes: 0 additions & 744 deletions .idea/workspace.xml

This file was deleted.

195 changes: 87 additions & 108 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
(function() {
angular.module('myapp', ['ui.bootstrap', 'ngAnimate', "ngTouch"])
.controller('myappController', function ($timeout, $document, $window, $location, $anchorScroll){
(function () {
angular.module('myapp', ['ui.bootstrap', 'ngAnimate', "ngTouch", "smoothScroll"])
.controller('myappController', function ($timeout, $document, $window, smoothScroll) {
var vm = this;
vm.ShowDiv=showdiv;
vm.$onInit=init();
vm.contentDivs =[false,false,false,false,false];
vm.DivPosition=[,"div2","div3","div4","div5"];
vm.contentDivsClass=["fa-circle-o","fa-circle-o","fa-circle-o","fa-circle-o","fa-circle-o"];
vm.ShowDiv = showdiv;
vm.$onInit = init();
vm.contentDivs = [false, false, false, false, false];
vm.DivPosition = [, "div2", "div3", "div4", "div5"];
vm.contentDivsClass = ["fa-circle-o", "fa-circle-o", "fa-circle-o", "fa-circle-o", "fa-circle-o"];
vm.contentDivsConnector = [];
vm.Comments = [false,false,false,false,false,false,false,false];
vm.Images_personal=[
{image: "assets/images/1_Persönlich/Elon-Musk.jpg", id:0},
{image: "assets/images/1_Persönlich/Elon-Musk1.jpeg", id:1}
vm.Comments = [false, false, false, false, false, false, false, false];
vm.Images_personal = [
{ image: "assets/images/1_Persönlich/Elon-Musk.jpg", id: 0 },
{ image: "assets/images/1_Persönlich/Elon-Musk1.jpeg", id: 1 }
];
vm.Images_paypal=[
{image: "assets/images/3_PayPal/smartphone1.jpg", id:0},
{image: "assets/images/3_PayPal/smartphone2.png", id:1},
{image: "assets/images/3_PayPal/whatispaypal.png", id:2},
{image: "assets/images/3_PayPal/paypal-working-functioning.png", id:3},
{image: "assets/images/3_PayPal/flowChart1.png", id:4},
{image: "assets/images/3_PayPal/flowChart2.png", id:5}
vm.Images_paypal = [
{ image: "assets/images/3_PayPal/smartphone1.jpg", id: 0 },
{ image: "assets/images/3_PayPal/smartphone2.png", id: 1 },
{ image: "assets/images/3_PayPal/whatispaypal.png", id: 2 },
{ image: "assets/images/3_PayPal/paypal-working-functioning.png", id: 3 },
{ image: "assets/images/3_PayPal/flowChart1.png", id: 4 },
{ image: "assets/images/3_PayPal/flowChart2.png", id: 5 }
];
vm.Images_tesla=[
{image: "assets/images/4_Tesla/Models/chassis-motor-p90d.jpg", id:0},
{image: "assets/images/4_Tesla/Model X/section-exterior-primary.jpg", id:1},
{image: "assets/images/4_Tesla/Model X/section-hero-background.jpg", id:2}
vm.Images_tesla = [
{ image: "assets/images/4_Tesla/Models/chassis-motor-p90d.jpg", id: 0 },
{ image: "assets/images/4_Tesla/Model X/section-exterior-primary.jpg", id: 1 },
{ image: "assets/images/4_Tesla/Model X/section-hero-background.jpg", id: 2 }
];
vm.Images_spacex=[
{image: "assets/images/5_SpaceX/falcon9-render.png", id:0},
{image: "assets/images/5_SpaceX/falcon-heavy-render.png", id:1},
{image: "assets/images/5_SpaceX/landing.jpg", id:2},
{image: "assets/images/5_SpaceX/launch.jpg", id:3},
{image: "assets/images/5_SpaceX/ses10_launch3.jpg", id:4}
vm.Images_spacex = [
{ image: "assets/images/5_SpaceX/falcon9-render.png", id: 0 },
{ image: "assets/images/5_SpaceX/falcon-heavy-render.png", id: 1 },
{ image: "assets/images/5_SpaceX/landing.jpg", id: 2 },
{ image: "assets/images/5_SpaceX/launch.jpg", id: 3 },
{ image: "assets/images/5_SpaceX/ses10_launch3.jpg", id: 4 }
];
vm.Images_hyperloop=[
{image: "assets/images/6_Hyperloop/hyperloop-transportation.jpg", id:0},
{image: "assets/images/6_Hyperloop/Hyperloop_all_cutaway.png", id:1},
{image: "assets/images/6_Hyperloop/hyperloopconcept.jpg", id:2},
{image: "assets/images/6_Hyperloop/image_desert.jpg", id:3},
{image: "assets/images/6_Hyperloop/the_hyperloop.png", id:4}
vm.Images_hyperloop = [
{ image: "assets/images/6_Hyperloop/hyperloop-transportation.jpg", id: 0 },
{ image: "assets/images/6_Hyperloop/Hyperloop_all_cutaway.png", id: 1 },
{ image: "assets/images/6_Hyperloop/hyperloopconcept.jpg", id: 2 },
{ image: "assets/images/6_Hyperloop/image_desert.jpg", id: 3 },
{ image: "assets/images/6_Hyperloop/the_hyperloop.png", id: 4 }
];
vm.Images_theboringcompany=[
{image: "assets/images/7_The Boring Company/tunnel-boring-company-borer.jpg", id:0}
vm.Images_theboringcompany = [
{ image: "assets/images/7_The Boring Company/tunnel-boring-company-borer.jpg", id: 0 }
];
vm.myInterval = 5000;
vm.noWrapSlides = false;
Expand All @@ -51,119 +51,99 @@
vm.StickPos = [0, 0];//x,y
vm.Viewport = [$("body").innerWidth(), $("body").innerHeight()];
vm.InitHeigth = vm.Viewport[1];
vm.ScrollTo = ['landing', 'timeline', 'end'];
vm.ScrollTo = [$document[0].getElementById("landing"), $document[0].getElementById("timeline"), $document[0].getElementById("ending")];
vm.ScrollIndex = 1;
vm.ScrollUp = 0;
vm.IsMoving = null;


function endmove(event) {
if (event.key==="ArrowDown" || event.key==="ArrowUp" ||event.key==="ArrowLeft" || event.key==="ArrowRight") {
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "ArrowLeft" || event.key === "ArrowRight") {
vm.IsMoving = false;
}
}

function move(event) {
var stick = $document[0].getElementById("stickman");
if(event.key==="ArrowDown")
{
vm.StickPos[1]+=10;
TweenLite.to(stick, 1.5, {y: vm.StickPos[1]});
if (event.key === "ArrowDown") {
vm.StickPos[1] += 10;
TweenLite.to(stick, 1.5, { y: vm.StickPos[1] });
vm.IsMoving = true;
}
else if(event.key==="ArrowUp")
{
vm.StickPos[1]-=10;
TweenLite.to(stick, 1.5, {y: vm.StickPos[1]});
else if (event.key === "ArrowUp") {
vm.StickPos[1] -= 10;
TweenLite.to(stick, 1.5, { y: vm.StickPos[1] });
vm.IsMoving = true;
}
else if(event.key==="ArrowRight")
{
vm.StickPos[0]+=10;
TweenLite.to(stick, 1.5, {x: vm.StickPos[0]});
else if (event.key === "ArrowRight") {
vm.StickPos[0] += 10;
TweenLite.to(stick, 1.5, { x: vm.StickPos[0] });
vm.IsMoving = true;
}
else if(event.key==="ArrowLeft")
{
vm.StickPos[0]-=10;
TweenLite.to(stick, 1.5, {x: vm.StickPos[0]});
else if (event.key === "ArrowLeft") {
vm.StickPos[0] -= 10;
TweenLite.to(stick, 1.5, { x: vm.StickPos[0] });
vm.IsMoving = true;
}

console.log($(stick).offset().top ,vm.Viewport[1]);
console.log($(stick).offset().top, vm.Viewport[1]);

if ($(stick).offset().top > (vm.Viewport[1])) {
$location.hash(vm.ScrollTo[vm.ScrollIndex]);
$anchorScroll();
smoothScroll(vm.ScrollTo[vm.ScrollIndex]);
vm.ScrollIndex += 1 % 2;
vm.Viewport[1] +=vm.InitHeigth;
vm.Viewport[1] += vm.InitHeigth;
}
else {
switch (vm.ScrollIndex) {
switch (vm.ScrollIndex) {
case 1:
break;
case 2:
if ($(stick).offset().top < vm.InitHeigth) {
$location.hash(vm.ScrollTo[vm.ScrollIndex-2]);
$anchorScroll();
vm.ScrollIndex -= 1 %2;
smoothScroll(vm.ScrollTo[vm.ScrollIndex - 2]);
vm.ScrollIndex -= 1 % 2;
vm.Viewport[1] -= vm.InitHeigth;
}
break;
case 3:
if ($(stick).offset().top < (vm.InitHeigth*2)) {
$location.hash(vm.ScrollTo[vm.ScrollIndex - 2]);
$anchorScroll();
if ($(stick).offset().top < (vm.InitHeigth * 2)) {
smoothScroll(vm.ScrollTo[vm.ScrollIndex - 2]);
vm.ScrollIndex -= 1 % 2;
vm.Viewport[1] -= vm.InitHeigth;
}

}
}


//if ($(stick).offset().top+100 < vm.ScrollUp) {
// $location.hash(vm.ScrollTo[vm.ScrollIndex-1]);
// $anchorScroll();
// vm.ScrollIndex -= 1 % 3;
// vm.ScrollUp += vm.Viewport[1];
//}
//var position = $(stick).offset();

//console.log(position);
}
}
}



$window.addEventListener("keydown", function(e) {

$window.addEventListener("keydown", function (e) {
// space and arrow keys
if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
if ([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
e.preventDefault();
}
}, false);

function init() {
startQuotes(3000);
var stick = $document[0].getElementById("stickman");
TweenLite.from(stick, 4,{left:-500});
TweenLite.from(stick, 4, { left: -500 });
$timeout(function () {
showdiv(0);
},1);

}, 1);
}

function startQuotes(timer) {
$timeout(function () {
var rnd=Math.floor(Math.random()*vm.Comments.length);
var rnd = Math.floor(Math.random() * vm.Comments.length);
vm.Comments[rnd] = true;
$timeout(function () {
vm.Comments[rnd] = false;
startQuotes(0);
},5000);
},timer);
}, 5000);
}, timer);
}
function showdiv(number)
{
function showdiv(number) {
setTimeline(number);
setAllcontentDivsFalse();
vm.contentDivs[number] = true;
Expand All @@ -174,49 +154,48 @@
setAllcontentDivsConnectorBlack();
}
function setTimeline(newStatus) {
var lastDiv= getTimelineStatus();
if (newStatus === lastDiv && lastDiv != 0){
var lastDiv = getTimelineStatus();
if (newStatus === lastDiv && lastDiv != 0) {
return;
}
else if(newStatus>=lastDiv){
for(var i = 0; i<=newStatus;i++)
{
vm.contentDivsClass[i] ="fa-circle timeline-reached";
vm.contentDivsConnector[i-1]="timeline-reached-connector";
else if (newStatus >= lastDiv) {
for (var i = 0; i <= newStatus; i++) {
vm.contentDivsClass[i] = "fa-circle timeline-reached";
vm.contentDivsConnector[i - 1] = "timeline-reached-connector";
}
}
else if(newStatus< lastDiv){
for(var diff = lastDiv-newStatus; diff>0;diff--){
vm.contentDivsClass[lastDiv]="fa-circle-o";
vm.contentDivsConnector[lastDiv-1] = "timeline-not-reached-connector";
else if (newStatus < lastDiv) {
for (var diff = lastDiv - newStatus; diff > 0; diff--) {
vm.contentDivsClass[lastDiv] = "fa-circle-o";
vm.contentDivsConnector[lastDiv - 1] = "timeline-not-reached-connector";
lastDiv--;
}
}
}
function getTimelineStatus() {
var lastTrueDiv;
for(var i =0; i<vm.contentDivs.length;i++){
if(vm.contentDivs[i] === true){
for (var i = 0; i < vm.contentDivs.length; i++) {
if (vm.contentDivs[i] === true) {
lastTrueDiv = i;
}
}
if(!lastTrueDiv){
lastTrueDiv=0;
if (!lastTrueDiv) {
lastTrueDiv = 0;
}
return lastTrueDiv;
}
function setAllcontentDivsFalse() {
for(var i =0; i<vm.contentDivs.length;i++){
for (var i = 0; i < vm.contentDivs.length; i++) {
vm.contentDivs[i] = false;
}
}
function setAllcontentDivsClassFalse() {
for(var i =0; i<vm.contentDivsClass.length;i++){
for (var i = 0; i < vm.contentDivsClass.length; i++) {
vm.contentDivsClass[i] = "fa-circle-o";
}
}
function setAllcontentDivsConnectorBlack() {
for(var i =0; i<vm.contentDivsConnector.length;i++){
for (var i = 0; i < vm.contentDivsConnector.length; i++) {
vm.contentDivsConnector[i] = "timeline-not-reached-connector";
}
}
Expand Down
Binary file added assets/images/portraits/speechbubble.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions bower_components/angular/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "angular",
"version": "1.6.4",
"license": "MIT",
"main": "./angular.js",
"ignore": [],
"dependencies": {},
"homepage": "https://github.com/angular/bower-angular",
"_release": "1.6.4",
"_resolution": {
"type": "version",
"tag": "v1.6.4",
"commit": "097304875bf47c499c7a45711e28f16937dfacfd"
},
"_source": "https://github.com/angular/bower-angular.git",
"_target": "^1.2.0",
"_originalSource": "angular"
}
21 changes: 21 additions & 0 deletions bower_components/angular/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Angular

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 15db659

Please sign in to comment.