Giter VIP home page Giter VIP logo

parallax-on-the-web-devtips-'s People

Contributors

alaister avatar dvvita avatar kinging123 avatar travisneilson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parallax-on-the-web-devtips-'s Issues

Spelling Correction

Hey Travis, awesome series. Quick spelling correction for line 74 in the index.jade file; it should read Fine Tailoring. You da man!

Github Pages Link

You should include the link to the Github pages in the read me somewhere preferably at the top. I first saw this video over the summer and didn't know what git hub pages were so I couldn't view the site back then. Not sure when you'll see this cause I know you're taking a break from devtips rn but I know other students might find it useful

Github Pages Link :
http://devtips.github.io/Parallax-on-the-Web-DevTips-/

Edge Problem with Footer Links

Great tutorial. I'm just about done with it but ran into a problem Internet Explorer Edge. If I use F12 developer tools and set it from Edge to 10 the footer links work fine. However in default mode the links in the footer using Internet Explorer 11 don't work. The site works perfect in Chrome, Firefox and Safari. Any ideas?

Grid Image

Travis,
I've got a problem. On 3:22 in the video( Part 3), the images are not showing on my browser. I am also using skeleton framework. I'm not quite sure if the problem is in my browser(Mozilla 53.0.3 (32-bit))? I just copied the code you provided on the video. How would I fix this?

P.S: The final output of your github code is working. (very confusing)

Files link: https://www.dropbox.com/sh/89g3qmn977nfk7c/AAABm1rpDofesIoXHzRbH0kca?dl=0

THANK YOU!

Live demo

I kindly request that you make a live demo, ideally using GitHub pages. I am curious to see the end-result.

Path in Windows (local test)

Using the latest 0.3 Version on a Windows7 machine I had some trouble testing locally.
I figured out that I needed to change the paths to the img src's in index.html from

src="/images/..." to
src="images/... "

and in style.css the background-image urls to

background-image: url('../images/...

But now works like a charme as expected

Thx Travis

Horizontal parallax effect (And easing function)

Hi there Travis 👍

First of all I want to take a moment to thank you for the videos you create. They're very informative, clear and I can say they've helped me become a better web developer/designer.

I found your channel while looking for good CSS animation tutorials and in under a week I was addicted to your channel. I ended up watching your series "parallax on the web". Both these series answered so many questions I still had about the web design industry and thanks to you I now have a much better understanding of these (and many more) subjects.


With the "thank you" out of the way I wanted to kind of request a new part to the parallax series. In the first episode you start out by showing off a whole list of cool examples already out there. While you covered the biggest part of all the different categories you listed you didn't do all of them. The ones I would be particularly interested in would be the designs where a certain element would move along with you the entire way through the page.

Another parallax effect I was very interested in was one where a certain element would move horizontally while the user scrolled. That one I figured I could take on my own.


So I started investigating. The goal was to create an element that would move horizontally while the user scrolled the web page. The object would start "moving" as it came into view and be on the other side as it went out of view. Another requirement was that the screen size should not matter. The entire "user controlled animation" should be responsive.

Linear function 👨‍💻

I started out by creating a linear function that would do this. By emphasising the fact that the moving-element would start as it came into view and finish as it went out of view I came up with a basic mathematical function to calculate the position of this moving element. The solution I came up with would work across all screen sizes.

My idea was that there was a relation between the height and the width of the screen. If the screen was 1000px high and 500px wide the moving-element would only have to move half the amount of scrolled pixels to the right. If the screen was 600px high and 200px wide the moving-element would only have to move 1/3 of the amount of scrolled pixels to the right.

In other words: The amount of pixels we need to move the moving-element to the right would be:

(screenWidth / screenHeight) * amount_px_scrolled

To clarify myself a bit further I went ahead and created a graph. Consider the orange line in the following image:

To clarify: Take the amount of pixels scrolled since the moving-element was first visible and insert a horizontal line on that position. The point where the line you just imagined crosses the orange line is where the moving-element should be positioned horizontally.

Pretty cool huh?


While this function works pretty well: it's scalable and correct (there is no guesswork going on) I wasn't happy yet. There were still a few improvements to be made.

Easing function 👨‍💻

After watching the (as of this moment) last video in the parallax series I came to the conclusion that my boring old linear function wasn't gonna work. We needed an easing function; mainly to make sure the user can focus on the moving-element a bit better as it passes through the middle.

Unfortunately for me this was easier said than done. But I went on with the idea anyway.

I thought about what exactly I wanted to create over and over again. I drew countless images of how the element should progress as it passed through the screen, I took multiple shots at the maths behind it until it occurred to me.

Let's go back to that same image again. Consider the blue line this time.

As you can see the blue line progresses faster on the edges of the screen and stands still for a bit on the middle of the screen.

The form of the graph is quite particular. It reminded me of maths. I remembered that the function would have to be look something like this in order to get that same effect:

y = a(x-b)^3

I decided that the moving element would be positioned in the center of the page to start with. This way I could move the moving-element left or right accordingly.
Along with that I decided to give the graph a little more meaning. Consider the following image:

In this image the vertical axis represents the amount of pixels scrolled since the element came into view. This axis has a max of the screen height since after that the element will be out of view.
The horizontal axis represents the amount of pixels to move the moving-element relative to the horizontal center of the page. The maximal values of this axis would be +/- half the width of screen. After the element has moved half of the screens width away from the center it goes out of view.


With a clear image of what I wanted to create in mind it was time to solve the math. Unfortunately I'm not all that good at maths and after an attempt to solve this problem I realised I wasn't gonna succeed.

Fortunately for me, I came with the idea to post my question on math.stackexchange.com, stack-overflow's mathematical sister site. After clarifying my question a few times one of their users was able to create the mathematical function for me.

Remember that the function had to be a function that would output the moving-elements position in pixels relative to the horizontal center of the page based on the amount of pixels scrolled since the element was first visible. The function would have to be "steeper" on the edges and ease into a short stop in the middle and be usable across every possible screen size. Meaning that the mathematical function would have to be positioned based on two variables, screen height and -width.

The function they created ended up looking like this:

position = (4 * (s-width) / (s-height)^3) * (px_scrolled - ((s-height) /2 ))^3

(where "s-" is short for screen)

I've written it out in a more compact way that's impossible on GitHub:

image


This function works! I went ahead and coded it all out in JavaScript on codepen. You can check the pen out here.

The mathematical function written out in JavaScript looks like this:

var pos = ((4*win_width)/(Math.pow(win_height, 3))) * Math.pow(px_since_visible - (win_height/2),3)

Why am I telling you all this? 🙋

First of all, I'm a big believer in open source code. The general idea of open source speaks to me. For this reason I really hope that you can use the function I created in some way and possibly to share my findings with your big audience of web developers. They could all possibly benefit from this in some way.

Another side effect would be that some people might think they have a better way to handle the easing in this example. Or perhaps create a different type of easing function. Maybe one that doesn't stop in the center. I'd be very very happy to discuss ideas with people. As I said before: big believer in open source. Working together creates better solutions.

Secondly I actually hope that you'll take my idea, the horizontal easing function, and use it to perhaps kick off the parallax series again. I really enjoyed the series and as I said at the start: there is still some content you could possibly cover.

That being said I do realise that the chances of all this happening are kind of slim and I really don't want this to become me begging you. Just realise there is still people watching that "old" series.


This has become quite an article. Time for me to wrap things up. I hope you'll spread the code I created in some way, mainly because I want other people to benefit from the bit of thinking I've done.


Oh.. one last note: I'd really want to become a patreon, but unfortunately I can't seen my financial situation at this time.

Keep on hacking 👍

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.