MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/b2o6f2/whats_your_favorite_most_useful_javascript/eiumray
r/javascript • u/Linux_is_awesome • Mar 18 '19
422 comments sorted by
View all comments
5
I like this a lot because it uses time itself for the animation.
let currentDate = new Date(); hero.y = 100 + (Math.cos(currentDate.getTime() * 0.002) * 25);
1 u/[deleted] Apr 02 '19 [removed] — view removed comment 2 u/kommentz Apr 03 '19 I cheated. This was a snippet of ActionScript 3, oscillating an object on its Y axis but it would work in Canvas (pretty much) so I showed it.
1
[removed] — view removed comment
2 u/kommentz Apr 03 '19 I cheated. This was a snippet of ActionScript 3, oscillating an object on its Y axis but it would work in Canvas (pretty much) so I showed it.
2
I cheated. This was a snippet of ActionScript 3, oscillating an object on its Y axis but it would work in Canvas (pretty much) so I showed it.
5
u/kommentz Mar 19 '19
I like this a lot because it uses time itself for the animation.