-
+// SOCKET //////////////////////////////////////////////////////////////////////
-
-You need to sign in or sign up before continuing.
-
-
-
-
-
-
--GitLab.com -
-
-
-
+ let socket = io.connect('/')
-
-GitLab.com offers free unlimited (private) repositories and unlimited collaborators.
- Explore projects on GitLab.com (no login needed)
- More information about GitLab.com
- GitLab.com Support Forum
- GitLab Homepage
By signing up for and by signing in to this service you accept our:
+ socket.on('connection', function(){ + console.log('connected to node server') + socket.emit('animationInit') + makeAnimation() + }) -
-
-
-
+ function frame() {
+ now = timeStamp()
+ delta += Math.min(1, (now - last) / 1000)
+ while(delta > step){
+ delta -= step
+ update(step)
+ }
+ last = now
+ requestAnimationFrame(frame)
+ }
+ requestAnimationFrame(frame)
+ }
-
+ socket.on('frameData', function(data){
+ imgs.length < data.frames.length ? new_imgs = data.frames.slice(imgs.length) : new_imgs = []
+ new_imgs.forEach(function(img){ add_img(img) })
+ })
-
-
-
-
-
-
-
-
-
+ let frames_per_sec = 7,
+ current_frame = 0,
+ forward = true
-
-
-
-
+ function makeAnimation(){
+ let now,
+ delta = 0,
+ last = timeStamp(),
+ step = 1/frames_per_sec
-
-